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: Sync to Hugging Face Space | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| jobs: | |
| sync-space: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Clone repo and rename | |
| run: git clone https://${{ secrets.HF_USERNAME }}:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/mozilla-ai/transcribe hf-space | |
| - name: Copy demo app and requirements | |
| run: | | |
| cp demo/transcribe_app.py hf-space/app.py | |
| cp demo/requirements.txt hf-space/requirements.txt | |
| - name: Check if there are any changes | |
| id: check_changes | |
| run: | | |
| cd hf-space | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add . | |
| if git diff-index --quiet HEAD; then | |
| echo "No changes to commit" | |
| echo "changes=false" >> $GITHUB_ENV | |
| else | |
| echo "changes=true" >> $GITHUB_ENV | |
| fi | |
| - name: Commit and push changes to Hugging Face | |
| if: env.changes == 'true' | |
| run: | | |
| cd hf-space | |
| git commit -m "Sync with https://github.com/mozilla-ai/speech-to-text-finetune" | |
| git push https://${{ secrets.HF_USERNAME }}:${{ secrets.HF_TOKEN }}@huggingface.co/spaces/mozilla-ai/transcribe main | |
| - name: Reboot Space | |
| if: always() | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| pip install huggingface_hub | |
| python demo/reboot_hf_space.py |