JiMengIntl / .github /workflows /deploy-hf-space.yml
github-actions[bot]
Deploy from GitHub Actions
8e02bdb
name: Deploy Hugging Face Space
on:
push:
branches:
- main
paths:
- 'huggingface-HF-JiMeng/**'
- '.github/workflows/deploy-hf-space.yml'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Push Space files to Hugging Face
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_SPACE_REPO: ${{ secrets.HF_SPACE_REPO }}
run: |
test -n "$HF_TOKEN"
test -n "$HF_SPACE_REPO"
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git clone "https://oauth2:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE_REPO}" hf-space
rsync -av --delete \
--exclude '.git/' \
--exclude 'hf-space/' \
--exclude 'huggingface-HF-JiMeng/' \
--exclude 'node_modules/' \
--exclude 'dist/' \
--exclude 'doc/' \
--exclude 'capture-output/' \
--exclude 'Toonflow-app/' \
--exclude '.env' \
--exclude '*.log' \
--exclude '*.png' \
--exclude '*.jpg' \
--exclude '*.jpeg' \
--exclude '*.webp' \
--exclude '*.gif' \
--exclude '*.bmp' \
--exclude '*.mp4' \
./ hf-space/
cp huggingface-HF-JiMeng/Dockerfile hf-space/Dockerfile
cp huggingface-HF-JiMeng/README.md hf-space/README.md
cp huggingface-HF-JiMeng/.dockerignore hf-space/.dockerignore
cd hf-space
if git status --short | grep .; then
git add .
git commit -m "Deploy from GitHub Actions"
git push
else
echo "No changes to deploy"
fi