jebin2 commited on
Commit
7c61594
·
1 Parent(s): 919b1bf
Files changed (1) hide show
  1. .github/workflows/sync-to-hf.yml +32 -0
.github/workflows/sync-to-hf.yml CHANGED
@@ -15,15 +15,47 @@ jobs:
15
  fetch-depth: 0
16
  lfs: true
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  - name: Fetch all LFS objects
19
  run: |
20
  git lfs fetch --all
21
  git lfs checkout
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  - name: Push to Hugging Face Space
24
  env:
25
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
26
  run: |
 
27
  git remote add space https://jebin2:${HF_TOKEN}@huggingface.co/spaces/jebin2/Paper
28
  git lfs push --all space main
29
  git push --force space main
 
15
  fetch-depth: 0
16
  lfs: true
17
 
18
+ - name: Configure Git
19
+ run: |
20
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
21
+ git config --global user.name "github-actions[bot]"
22
+
23
+ - name: Commit any uncommitted changes
24
+ run: |
25
+ git add -A
26
+ git diff --staged --quiet || git commit -m "Save working directory before LFS migration"
27
+
28
+ - name: Configure Git LFS
29
+ run: |
30
+ git lfs install
31
+
32
  - name: Fetch all LFS objects
33
  run: |
34
  git lfs fetch --all
35
  git lfs checkout
36
 
37
+ - name: Migrate existing files to LFS
38
+ run: |
39
+ git lfs migrate import --include="*.jpg,*.jpeg,*.png,*.gif,*.mp3,*.mp4,*.wav,*.ttf,*.db,sliding_puzzle,stockfish/stockfish-ubuntu-x86-64-avx2" --everything
40
+
41
+ - name: Track binary files with LFS
42
+ run: |
43
+ git lfs track "*.jpg" "*.jpeg" "*.png" "*.gif" "*.mp3" "*.mp4" "*.wav" "*.ttf" "*.db"
44
+ git lfs track "sliding_puzzle"
45
+ git lfs track "stockfish/stockfish-ubuntu-x86-64-avx2"
46
+ git add .gitattributes
47
+ git diff --staged --quiet || git commit -m "Configure Git LFS tracking"
48
+
49
+ - name: Fetch LFS objects after migration
50
+ run: |
51
+ git lfs fetch --all
52
+ git lfs pull
53
+
54
  - name: Push to Hugging Face Space
55
  env:
56
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
57
  run: |
58
+ git remote remove space 2>/dev/null || true
59
  git remote add space https://jebin2:${HF_TOKEN}@huggingface.co/spaces/jebin2/Paper
60
  git lfs push --all space main
61
  git push --force space main