Aditya "Sree" Sreevatsa K
ci: support GitHub main/master deployment to Hugging Face main
8522e57 unverified
Raw History Blame Contribute Delete
1.51 kB
name: Deploy to Hugging Face Space
on:
push:
branches: [ main, master ]
permissions:
contents: read
concurrency:
group: utility-shelf-deployment
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repo
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Push to Hugging Face
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git remote add hf https://__token__:${HF_TOKEN}@huggingface.co/spaces/AdityaSreevatsaK/Utility-Shelf
git push hf HEAD:main
env:
HF_TOKEN: ${{ secrets.HF_UTILITY_SHELF_TOKEN }}
- name: Check Hugging Face build and runtime
env:
EXPECTED_SHA: ${{ github.sha }}
run: python scripts/check_hf_space.py --repo AdityaSreevatsaK/Utility-Shelf --expected-sha "$EXPECTED_SHA"
- name: Show Hugging Face build logs on failure
if: failure()
env:
HF_TOKEN: ${{ secrets.HF_UTILITY_SHELF_TOKEN }}
run: |
echo "Reading last 120 Space build log lines (credentials are masked)..."
curl --fail --silent --show-error --max-time 15 \
--header "Authorization: Bearer ${HF_TOKEN}" \
"https://huggingface.co/api/spaces/AdityaSreevatsaK/Utility-Shelf/logs/build?tail=120" \
| tail -n 120 || true