GAIT_API / .github /workflows /deploy-hf-space.yml
UdasriHasindu
fix: action 2
b3b9fd5
Raw
History Blame Contribute Delete
981 Bytes
name: Deploy to Hugging Face Space
on:
push:
branches: ["main"]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Push to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
set -euo pipefail
HF_TOKEN_CLEAN="$(printf '%s' "${HF_TOKEN}" | tr -d '\r\n' | xargs)"
if [ -z "${HF_TOKEN_CLEAN}" ]; then
echo "HF_TOKEN secret is missing/empty after trimming"
exit 1
fi
git remote remove hf 2>/dev/null || true
git remote add hf "https://user:${HF_TOKEN_CLEAN}@huggingface.co/spaces/xplorers/GAIT_API"
git push --force hf HEAD:main