| 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 |
| |
| |
| 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 -- . |
| |
| |
| 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 |
|
|