GSoumyajit2005 commited on
Commit
b477631
·
1 Parent(s): 7630bcd

Fix CI/CD: Use force push to sync LFS history

Browse files
Files changed (1) hide show
  1. .github/workflows/deploy.yml +11 -3
.github/workflows/deploy.yml CHANGED
@@ -1,7 +1,9 @@
1
  name: Sync to Hugging Face Spaces
 
2
  on:
3
  push:
4
  branches: [main]
 
5
  jobs:
6
  sync-to-hub:
7
  runs-on: ubuntu-latest
@@ -10,15 +12,21 @@ jobs:
10
  uses: actions/checkout@v3
11
  with:
12
  fetch-depth: 0
 
 
13
  - name: Push to Hugging Face
14
  env:
15
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
16
  HF_USERNAME: GSoumyajit2005
17
  SPACE_NAME: invoice-processor-ml
18
  run: |
 
19
  git config --global user.email "actions@github.com"
20
  git config --global user.name "GitHub Actions"
 
 
21
  git remote add space https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME
22
- git fetch space main
23
- git merge space/main --allow-unrelated-histories -X ours -m "Sync GitHub code with HF models"
24
- git push space main
 
 
1
  name: Sync to Hugging Face Spaces
2
+
3
  on:
4
  push:
5
  branches: [main]
6
+
7
  jobs:
8
  sync-to-hub:
9
  runs-on: ubuntu-latest
 
12
  uses: actions/checkout@v3
13
  with:
14
  fetch-depth: 0
15
+ lfs: true # Explicitly enable LFS fetching
16
+
17
  - name: Push to Hugging Face
18
  env:
19
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
20
  HF_USERNAME: GSoumyajit2005
21
  SPACE_NAME: invoice-processor-ml
22
  run: |
23
+ # 1. Configure Git
24
  git config --global user.email "actions@github.com"
25
  git config --global user.name "GitHub Actions"
26
+
27
+ # 2. Add Remote
28
  git remote add space https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME
29
+
30
+ # 3. Force Push (Overwrite HF with GitHub's clean version)
31
+ # We skip the fetch/merge steps because we want GitHub to be the source of truth
32
+ git push space main --force