billingsmoore's picture
Claude Sonnet 5
Bump actions/checkout and actions/setup-python to v7
d51261b
Raw History Blame Contribute Delete
1.99 kB
name: Deploy to HF Space
# Two triggers:
# - workflow_dispatch: manual, always deploys.
# - schedule: nightly at 00:00 UTC, but only if main has changed since
# the last deploy (compared directly against what's already on the
# hf-tts remote) — a no-op night doesn't rebuild the Space.
on:
workflow_dispatch: {}
schedule:
- cron: "0 0 * * *"
jobs:
check-for-changes:
name: Check for changes since last deploy
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.check.outputs.changed }}
steps:
- uses: actions/checkout@v7
- id: check
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git remote add hf-tts "https://user:${HF_TOKEN}@huggingface.co/spaces/GarchenArchive/ArchiveAI-TTS"
if git fetch hf-tts main --quiet 2>/dev/null && [ "$(git rev-parse HEAD)" = "$(git rev-parse hf-tts/main)" ]; then
echo "No changes on main since the last deploy — skipping nightly run."
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "main has changed (or no prior deploy found) — proceeding."
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
deploy:
name: Push to GarchenArchive/ArchiveAI-TTS
needs: check-for-changes
if: always() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.changed == 'true')
runs-on: ubuntu-latest
concurrency:
group: archiveai-tts-deploy
cancel-in-progress: false
steps:
- uses: actions/checkout@v7
with:
lfs: true
fetch-depth: 0 # HF's git server rejects a shallow push ("shallow update not allowed")
- name: Push to HF Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git remote add hf-tts "https://user:${HF_TOKEN}@huggingface.co/spaces/GarchenArchive/ArchiveAI-TTS"
git push hf-tts HEAD:main --force