Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish demo to Hugging Face Spaces | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| sync-space: | |
| runs-on: ubuntu-latest | |
| env: | |
| REPO_NAME: mozilla-ai/any-agent | |
| HTTPS_REPO: https://${{ secrets.HF_USERNAME }}:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/mozilla-ai/any-agent-demo | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - run: git clone ${{ env.HTTPS_REPO}} hf-space | |
| - run: | | |
| cp -rT demo hf-space | |
| - run: | | |
| cd hf-space | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add . | |
| git commit -m "Sync with https://github.com/${{ env.REPO_NAME }}" | |
| - name: Push to Hugging Face | |
| run: | | |
| cd hf-space | |
| git push ${{ env.HTTPS_REPO}} main | |
| - name: Reboot Space | |
| if: always() | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| pip install huggingface_hub | |
| python demo/restart_space.py |