| name: Sync to HuggingFace Space | |
| on: | |
| push: | |
| branches: | |
| - release/* | |
| jobs: | |
| sync-to-hub: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| lfs: true | |
| - name: Configure Git | |
| run: | | |
| git config --global user.email "actions@github.com" | |
| git config --global user.name "GitHub Actions" | |
| - name: Push to HF Space | |
| run: | | |
| git remote add hf "https://api:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/${{ vars.HF_ORGANIZATION }}/${{ vars.HF_SPACE }}" | |
| git fetch hf | |
| git push hf HEAD:main --force | |
| - name: Print HF space status | |
| run: | | |
| echo "HF space status : https://${{ vars.HF_ORGANIZATION }}-${{ vars.HF_SPACE }}.hf.space" | |
| curl -X GET "https://api:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/${{ vars.HF_ORGANIZATION }}/${{ vars.HF_SPACE }}/status" | |