animebot / .github /workflows /deploy.yml
luci18's picture
Upload folder using huggingface_hub
e4ccb70 verified
Raw History Blame Contribute Delete
1.21 kB
name: Deploy to Hugging Face
on:
push:
branches: [ main, master ]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Setup Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
- name: Push to Hugging Face
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_SPACE_ID: luci18/animebot
run: |
# Install Hugging Face CLI
pip install huggingface-hub
# Authenticate
huggingface-cli login --token $HF_TOKEN
# Clone the space
git clone https://huggingface.co/spaces/$HF_SPACE_ID hf-space
# Copy files (excluding secrets)
rsync -av --exclude='.git' --exclude='.env' --exclude='downloads' --exclude='encodes' --exclude='temp' --exclude='*.session' --exclude='__pycache__' . hf-space/
# Commit and push
cd hf-space
git add .
git commit -m "Deploy from GitHub Actions - $(date)" || echo "No changes to commit"
git push