| name: Sync to Hugging Face Hub |
|
|
| on: |
| push: |
| branches: [main] |
| workflow_dispatch: |
|
|
| jobs: |
| sync-to-hub: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v4 |
| with: |
| lfs: true |
|
|
| - name: Install git-lfs |
| run: | |
| sudo apt-get update |
| sudo apt-get install git-lfs |
| git lfs install |
| |
| - name: Set up Git |
| run: | |
| git config --global user.email "actions@github.com" |
| git config --global user.name "GitHub Actions" |
| |
| - name: Clone Hugging Face Space |
| env: |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| run: | |
| git clone https://user:${HF_TOKEN}@huggingface.co/spaces/Al04ni/UChat hf_repo |
| rsync -av --exclude='.git' . hf_repo # Sync files, avoiding overwriting .git |
| cd hf_repo |
| git add . |
| git commit -m "Sync from GitHub Actions" || echo "No changes to commit" |
| git push origin main |
| |