Download .github/workflows/deploy.yml from xplorers/MIS_API: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/spaces/xplorers/MIS_API/resolve/main/.github/workflows/deploy.yml
- Command line
-
hf download hf://spaces/xplorers/MIS_API/.github/workflows/deploy.yml
-
curl -L -o deploy.yml https://huggingface.co/spaces/xplorers/MIS_API/resolve/main/.github/workflows/deploy.yml
1.31 kB
| name: Deploy to Hugging Face Spaces | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config --global user.name "GitHub Actions" | |
| git config --global user.email "actions@github.com" | |
| - name: Push to Hugging Face Spaces | |
| env: | |
| HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
| run: | | |
| # Fail immediately on any error | |
| set -euo pipefail | |
| # Validate token exists | |
| if [ -z "$HF_TOKEN" ]; then | |
| echo "❌ Error: HF_TOKEN secret is not set!" | |
| exit 1 | |
| fi | |
| # Remove any trailing whitespace from token | |
| HF_TOKEN="$(echo "$HF_TOKEN" | xargs)" | |
| # Add Hugging Face remote with embedded token (URL encoded) | |
| HF_REMOTE="https://huggingface_user:${HF_TOKEN}@huggingface.co/spaces/xplorers/MIS_API" | |
| git remote add hf "$HF_REMOTE" || git remote set-url hf "$HF_REMOTE" | |
| # Push to Hugging Face main branch | |
| echo "🚀 Pushing to Hugging Face Spaces..." | |
| git push -u hf main --force | |
| echo "✅ Successfully deployed to Hugging Face Spaces!" | |