daniel-was-taken commited on
Commit
4e293bb
·
1 Parent(s): 4b5e394

Update .gitattributes to use LFS for PDF, DOCX, and PPTX files; simplify workflow for pushing to Hugging Face

Browse files
Files changed (2) hide show
  1. .gitattributes +3 -3
  2. .github/workflows/main.yml +14 -52
.gitattributes CHANGED
@@ -34,7 +34,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  # Store binary docs via git-xet on push to Hugging Face
37
- *.pdf filter=xet -text
38
- *.docx filter=xet -text
39
- *.pptx filter=xet -text
40
 
 
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  # Store binary docs via git-xet on push to Hugging Face
37
+ *.pdf filter=lfs diff=lfs merge=lfs -text
38
+ *.docx filter=lfs diff=lfs merge=lfs -text
39
+ *.pptx filter=lfs diff=lfs merge=lfs -text
40
 
.github/workflows/main.yml CHANGED
@@ -8,65 +8,27 @@ on:
8
  jobs:
9
  sync-to-hub:
10
  runs-on: ubuntu-latest
11
-
12
  steps:
13
  - name: Checkout repository
14
  uses: actions/checkout@v3
15
  with:
16
  fetch-depth: 0
 
17
 
18
- # --------------------------------------------------
19
- # Install git-xet (required by Hugging Face Spaces for binaries)
20
- # --------------------------------------------------
21
- - name: Install git-xet
22
- run: |
23
- curl -L -o git-xet.tar.gz https://github.com/xetdata/xet-tools/releases/latest/download/xet-linux-x86_64.tar.gz
24
- sudo tar -xzf git-xet.tar.gz -C /usr/local/bin/
25
- git-xet --version
26
- git xet install
27
- rm -f git-xet.tar.gz
28
-
29
- # --------------------------------------------------
30
- # Authenticate git-xet against Hugging Face
31
- # --------------------------------------------------
32
- - name: Login to Xet (Hugging Face)
33
  env:
34
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
 
 
35
  run: |
36
- git xet login --user "daniel-was-taken" --email "actions@github.com" --password "$HF_TOKEN" --host huggingface.co --force
37
-
38
- # --------------------------------------------------
39
- # Git configuration
40
- # --------------------------------------------------
41
- - name: Configure Git User
42
- run: |
43
- git config --global user.name "GitHub Actions"
44
  git config --global user.email "actions@github.com"
45
-
46
- # --------------------------------------------------
47
- # Add Hugging Face remote (credentials for git-xet)
48
- # --------------------------------------------------
49
- - name: Add Hugging Face remote
50
- env:
51
- HF_TOKEN: ${{ secrets.HF_TOKEN }}
52
- run: |
53
- git remote add hf https://daniel-was-taken:$HF_TOKEN@huggingface.co/spaces/daniel-was-taken/CompifAI.git
54
- git remote add upstream_xet_repo https://daniel-was-taken:$HF_TOKEN@huggingface.co/spaces/daniel-was-taken/CompifAI.git || true
55
-
56
- # --------------------------------------------------
57
- # Re-encode binaries through git-xet filters and push to HF
58
- # (keeps GitHub history untouched; commit exists only in this job)
59
- # --------------------------------------------------
60
- - name: Push to Hugging Face via Xet
61
- env:
62
- HF_TOKEN: ${{ secrets.HF_TOKEN }}
63
- run: |
64
- # Initialize xet metadata against upstream
65
- git xet init --force || true
66
- git restore --source=HEAD :/ || true
67
- # Reapply clean filters so binaries are stored via xet
68
- git add --renormalize data .gitattributes || true
69
- git status
70
- git commit -m "ci: xet-encode binaries for HF" || true
71
- git fetch hf main || true
72
- git push hf HEAD:main --force-with-lease
 
8
  jobs:
9
  sync-to-hub:
10
  runs-on: ubuntu-latest
 
11
  steps:
12
  - name: Checkout repository
13
  uses: actions/checkout@v3
14
  with:
15
  fetch-depth: 0
16
+ lfs: true
17
 
18
+ - name: Push to hub
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  env:
20
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
21
+ # REPLACE 'daniel-was-taken' with your actual HF username
22
+ # REPLACE 'CompifAI' with your actual Space name
23
  run: |
 
 
 
 
 
 
 
 
24
  git config --global user.email "actions@github.com"
25
+ git config --global user.name "GitHub Actions"
26
+
27
+ # Force LFS tracking for PDFs just in case .gitattributes was missed
28
+ git lfs install
29
+ git lfs track "*.pdf"
30
+ git add .gitattributes
31
+
32
+ # Add the remote and push
33
+ git remote add hf https://daniel-was-taken:$HF_TOKEN@huggingface.co/spaces/daniel-was-taken/CompifAI
34
+ git push hf main --force