ALYYAN's picture
Update main.yaml
b1f0ee6 unverified
# .github/workflows/main.yml
# This workflow syncs the entire GitHub repository to a Hugging Face Space.
# It assumes large model files will be manually uploaded to the Space.
name: Sync to Hugging Face Space
on:
push:
branches:
- main
jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
# Step 1: Check out your code from GitHub
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# Step 2: Push the code to the Hugging Face Space remote
- name: Push to HF Space
env:
HF_USERNAME: ${{ secrets.HF_USERNAME }}
HF_SPACE_NAME: ${{ secrets.HF_SPACE_NAME }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
# Add the Hugging Face Space as a remote named 'hf_space'
git remote add hf_space https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE_NAME}
# Force push the local 'main' branch to the remote's 'main' branch
# This ensures the Space is an exact mirror of your GitHub repo
git push --force hf_space main