Spaces:
Running
Running
new ch
Browse files
.github/workflows/sync-to-hf.yml
CHANGED
|
@@ -2,20 +2,60 @@ 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 |
- uses: actions/checkout@v3
|
| 13 |
with:
|
| 14 |
fetch-depth: 0
|
| 15 |
-
lfs: true
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
env:
|
| 18 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 19 |
run: |
|
| 20 |
-
git remote
|
| 21 |
-
git
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
on:
|
| 4 |
push:
|
| 5 |
+
branches: [main]
|
| 6 |
+
workflow_dispatch:
|
| 7 |
|
| 8 |
jobs:
|
| 9 |
sync-to-hub:
|
| 10 |
runs-on: ubuntu-latest
|
| 11 |
+
|
| 12 |
steps:
|
| 13 |
- uses: actions/checkout@v3
|
| 14 |
with:
|
| 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/comic-panel-extractor
|
| 60 |
+
git lfs push --all space main
|
| 61 |
+
git push --force space main
|