caviri commited on
Commit
667ff60
·
1 Parent(s): 629b3ac

ci: Simplifying CI-HF

Browse files
Files changed (1) hide show
  1. .github/workflows/push_to_hf.yml +15 -23
.github/workflows/push_to_hf.yml CHANGED
@@ -1,28 +1,20 @@
1
- name: Push to Hugging Face on PR merge
2
-
3
  on:
4
- pull_request:
5
- types: [closed]
 
 
6
 
7
  jobs:
8
- push_to_huggingface:
9
- if: github.event.pull_request.merged == true
10
  runs-on: ubuntu-latest
11
-
12
  steps:
13
- - name: Checkout GitHub repository
14
- uses: actions/checkout@v3
15
- with:
16
- path: github_repo # Change 'github_repo' to the desired directory name for the GitHub repo
17
-
18
- - name: Clone Hugging Face repository with token
19
- env:
20
- HF_TOKEN: ${{ secrets.HF_TOKEN }}
21
- HF_USERNAME: ${{ secrets.HF_USERNAME }}
22
- run: |
23
- git clone https://${{ env.HF_USERNAME }}:${{ env.HF_TOKEN }}@huggingface.co/spaces/SDSC/digiwild hf_repo
24
- rsync -av --exclude='hf_repo' github_repo/ hf_repo/
25
- cd hf_repo
26
- git add .
27
- git commit -m "Update from main branch"
28
- git push origin main
 
1
+ name: Sync to Hugging Face hub
 
2
  on:
3
+ push:
4
+ branches: [main]
5
+ # to run this workflow manually from the Actions tab
6
+ workflow_dispatch:
7
 
8
  jobs:
9
+ sync-to-hub:
 
10
  runs-on: ubuntu-latest
 
11
  steps:
12
+ - uses: actions/checkout@v3
13
+ with:
14
+ fetch-depth: 0
15
+ lfs: true
16
+ - name: Push to hub
17
+ env:
18
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
19
+ HF_USERNAME: ${{secrets.HF_USERNAME}}
20
+ run: git push https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/sdsc/digiwild main