Algoscope / .github /workflows /hf-deploy.yml
GitHub Actions
Deploy to HuggingFace Spaces
090c1e7
name: Deploy to HuggingFace Spaces
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install pnpm
run: npm install -g pnpm
- name: Build React frontend
working-directory: frontend
run: |
pnpm install --frozen-lockfile
pnpm build
- name: Push to HuggingFace Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git config --global user.email "deploy@github-actions.com"
git config --global user.name "GitHub Actions"
git checkout --orphan hf-deploy
git rm -rf assets/ 2>/dev/null || true
git rm -r --cached frontend/src/ 2>/dev/null || true
git rm -r --cached frontend/node_modules/ 2>/dev/null || true
git rm -r --cached frontend/public/ 2>/dev/null || true
cp README_HF.md README.md
git rm --cached README_HF.md 2>/dev/null || true
rm README_HF.md
git add -f frontend/dist/
git add .
git commit -m "Deploy to HuggingFace Spaces"
git remote add space https://odeliyach:$HF_TOKEN@huggingface.co/spaces/odeliyach/Algoscope
git push space hf-deploy:main --force