CAPS04-FE-REFACTOR / .github /workflows /deploy-huggingface.yml
wepee's picture
fix: separate Dockerfile for HF with storage dirs
7c34b9c
Raw
History Blame Contribute Delete
1.59 kB
name: Deploy Refactor to Hugging Face 0.2
on:
push:
branches:
- test
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout test branch
uses: actions/checkout@v4
with:
ref: test
fetch-depth: 0
- name: Verify Hugging Face token
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
python - <<'PY'
import os, urllib.request, json
token = os.environ.get("HF_TOKEN", "")
print("Token exists:", bool(token))
print("Token length:", len(token))
req = urllib.request.Request(
"https://huggingface.co/api/whoami-v2",
headers={"Authorization": f"Bearer {token}"}
)
try:
res = urllib.request.urlopen(req)
data = json.loads(res.read().decode())
print("HF user:", data.get("name"))
print("HF auth:", data)
except Exception as e:
print("TOKEN CHECK FAILED:", repr(e))
raise
PY
- name: Push refactor branch to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
cp Dockerfile.test Dockerfile
git config user.email "github-actions@github.com"
git config user.name "GitHub Actions"
git add Dockerfile
git commit -m "ci: use HF Dockerfile"
git remote add hf https://wepee:${HF_TOKEN}@huggingface.co/spaces/wepee/CAPS04-FE-REFACTOR
git push hf HEAD:main --force