PeptideAI / .github /workflows /push_to_hf.yml
github-actions
Sync from GitHub main
4466c5e
name: Sync with Hugging Face Space
on:
push:
branches: [main]
workflow_dispatch:
jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Push to Hugging Face Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git remote remove space 2>/dev/null || true
git remote add space https://m0ksh:${HF_TOKEN}@huggingface.co/spaces/m0ksh/PeptideAI-App
# Create a history-free sync branch so we don't push old binary blobs.
git config user.name "github-actions"
git config user.email "actions@github.com"
git checkout --orphan hf-sync
git rm -rf . >/dev/null 2>&1 || true
git checkout main -- .
# Hugging Face Spaces rejects raw binary blobs in git history.
rm -f PeptideAI/MLModels/*.pt PeptideAI/StreamlitApp/models/*.pt StreamlitApp/models/*.pt 2>/dev/null || true
git add -A
git commit -m "Sync from GitHub main" || true
git push --force space hf-sync:main