ArunCore / .github /workflows /deploy.yml
GitHub Actions Bot
deploy: automated sync from github main
985f3ee
Raw
History Blame Contribute Delete
1.58 kB
name: Sync to Hugging Face Space
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
sync-to-huggingface:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Push to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "actions@github.com"
git checkout --orphan hf-deploy-temp
git rm -rf --cached . 2>/dev/null || true
git add -A
git reset -- Images/ db/ *.png *.jpg *.jpeg 2>/dev/null || true
git commit -m "deploy: automated sync from github main" || true
git push --force https://neural-arun:${HF_TOKEN}@huggingface.co/spaces/neural-arun/ArunCore hf-deploy-temp:main
- name: Restart Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
echo "Triggering Space restart to apply new code..."
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-X POST "https://huggingface.co/api/spaces/neural-arun/ArunCore/restart?factory=true" \
-H "Authorization: Bearer ${HF_TOKEN}")
echo "HF Restart API response: $STATUS"
if [ "$STATUS" = "200" ] || [ "$STATUS" = "204" ]; then
echo "✅ Space restart triggered successfully!"
else
echo "⚠️ Restart returned status $STATUS — Space may need a manual restart."
fi