Deminiko commited on
Commit
c873c26
·
1 Parent(s): 750fff0

chore(ci): use push-to-huggingface workflow with lfs check

Browse files
Files changed (1) hide show
  1. .github/workflows/sync-to-hf.yml +20 -18
.github/workflows/sync-to-hf.yml CHANGED
@@ -1,12 +1,12 @@
1
- name: Sync to Hugging Face Space
2
 
3
  on:
4
  push:
5
- branches:
6
- - main
7
 
8
  jobs:
9
- sync:
10
  runs-on: ubuntu-latest
11
  steps:
12
  - name: Checkout repository
@@ -15,20 +15,22 @@ jobs:
15
  fetch-depth: 0
16
  lfs: true
17
 
18
- - name: Trigger HuggingFace Space Rebuild
 
 
 
 
 
 
 
 
 
 
19
  env:
20
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
21
  run: |
22
- # Install huggingface-hub CLI
23
- pip install huggingface-hub
24
-
25
- # Login to HuggingFace
26
- huggingface-cli login --token $HF_TOKEN
27
-
28
- # Push repo to HF Space using HF CLI
29
- git push https://NLarchive:[email protected]/spaces/NLarchive/my-webapp-hf main --force || true
30
-
31
- # Alternative: Trigger rebuild via API
32
- curl -X POST \
33
- -H "Authorization: Bearer $HF_TOKEN" \
34
- https://huggingface.co/api/spaces/NLarchive/my-webapp-hf/restart
 
1
+ name: Sync to Hugging Face hub
2
 
3
  on:
4
  push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
 
8
  jobs:
9
+ sync-to-hub:
10
  runs-on: ubuntu-latest
11
  steps:
12
  - name: Checkout repository
 
15
  fetch-depth: 0
16
  lfs: true
17
 
18
+ - name: Check large files
19
+ uses: ActionsDesk/[email protected]
20
+ with:
21
+ filesizelimit: 10485760 # 10MB
22
+
23
+ - name: Configure git
24
+ run: |
25
+ git config user.email "github-actions[bot]@users.noreply.github.com"
26
+ git config user.name "github-actions[bot]"
27
+
28
+ - name: Push to Hugging Face Space
29
  env:
30
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
31
  run: |
32
+ # Add space remote (ignore if exists)
33
+ git remote add space https://NLarchive:$HF_TOKEN@huggingface.co/spaces/NLarchive/my-webapp-hf || true
34
+
35
+ # Force push to the space
36
+ git push --force https://NLarchive:$HF_TOKEN@huggingface.co/spaces/NLarchive/my-webapp-hf main