github-actions
deploy: snapshot
5fa8558
raw
history blame contribute delete
836 Bytes
name: Deploy to Hugging Face Space
on:
push:
branches: ["main"]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout (shallow)
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Prepare clean deploy repo (no git history)
run: |
rm -rf .git
git init
git config user.email "actions@github.com"
git config user.name "github-actions"
git add .
git commit -m "deploy: snapshot"
- name: Push snapshot to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_SPACE_REPO: ${{ vars.HF_SPACE_REPO }}
run: |
git remote add hf https://user:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE_REPO}
git push hf HEAD:main --force