someone-in-the-world's picture
Claude Sonnet 5
Introduce a two-stage develop/main deploy flow (#27)
6e3ec3e unverified
Raw History Blame Contribute Delete
1.32 kB
name: Deploy to dev-en Space
on:
push:
branches: [develop]
workflow_dispatch: {}
concurrency:
group: deploy-dev-en
cancel-in-progress: false
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Push to Hugging Face Space (dev-en)
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_SPACE_ID: ${{ vars.HF_SPACE_ID_DEV_EN }}
run: |
if [ -z "$HF_TOKEN" ]; then
echo "::error::HF_TOKEN secret is not set on this repo (Settings > Secrets and variables > Actions)."
exit 1
fi
if [ -z "$HF_SPACE_ID" ]; then
echo "::error::HF_SPACE_ID_DEV_EN variable is not set on this repo (Settings > Secrets and variables > Actions > Variables), format: <owner>/<space-name>."
exit 1
fi
git remote add space "https://user:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE_ID}"
# No --force: a non-fast-forward push means the Space diverged from GitHub
# (e.g. edited directly in the HF UI) and needs a human to reconcile it,
# rather than silently overwriting that history.
git push space HEAD:main