Spaces:
Running
Running
P2SAMAPA commited on
Create sync_to_hf_space.yml
Browse files- sync_to_hf_space.yml +35 -0
sync_to_hf_space.yml
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Sync to HF Space
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [main] # fires on every push to main
|
| 6 |
+
workflow_dispatch: # allow manual trigger too
|
| 7 |
+
|
| 8 |
+
jobs:
|
| 9 |
+
sync:
|
| 10 |
+
runs-on: ubuntu-latest
|
| 11 |
+
timeout-minutes: 15
|
| 12 |
+
|
| 13 |
+
steps:
|
| 14 |
+
- name: Checkout repo (full history)
|
| 15 |
+
uses: actions/checkout@v4
|
| 16 |
+
with:
|
| 17 |
+
fetch-depth: 0 # full history needed for git push mirror
|
| 18 |
+
|
| 19 |
+
- name: Push to HF Space via git
|
| 20 |
+
env:
|
| 21 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 22 |
+
run: |
|
| 23 |
+
# Configure git
|
| 24 |
+
git config user.name "github-actions[bot]"
|
| 25 |
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
| 26 |
+
|
| 27 |
+
# Add HF Space as a remote using token auth
|
| 28 |
+
git remote add hf_space \
|
| 29 |
+
https://P2SAMAPA:${HF_TOKEN}@huggingface.co/spaces/P2SAMAPA/P2-ETF-DEEPWAVE-DL
|
| 30 |
+
|
| 31 |
+
# Force-push main → HF Space main branch
|
| 32 |
+
# (HF Spaces runs from the main branch by default)
|
| 33 |
+
git push hf_space main --force
|
| 34 |
+
|
| 35 |
+
echo "✅ GitHub → HF Space sync complete."
|