AutoSeg-Demo / .github /workflows /sync_to_hub.yml
GitHub Actions
deploy: Sync to HF Space (Clean)
3c0e82d
name: Sync to Hugging Face Hub
on:
push:
branches: [master, main]
jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- name: Push to Hub
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
# Replace with your Space ID (username/space-name)
# You can also use a GitHub Secret for this if you prefer
SPACE_ID: pranjal00/AutoSeg-Demo
run: |
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
# Create fresh orphan branch to drop history of heavy files
git checkout --orphan space-deploy
# Remove heavy files (documentation, config)
rm -rf documentation/ config/
# Stage and commit
git add .
git commit -m "deploy: Sync to HF Space (Clean)"
# Push to HF Space (Force overwrite)
git remote add space https://pranjal00:$HF_TOKEN@huggingface.co/spaces/$SPACE_ID
git push --force space space-deploy:main