Refactor GitHub Actions workflow for Hugging Face sync; simplify LFS handling and update push command
Browse files- .github/workflows/main.yml +6 -31
- .gitignore +1 -0
.github/workflows/main.yml
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
-
name: Sync to Hugging Face
|
2 |
-
|
3 |
on:
|
4 |
push:
|
5 |
branches: [main]
|
|
|
|
|
6 |
workflow_dispatch:
|
7 |
|
8 |
jobs:
|
@@ -12,34 +13,8 @@ jobs:
|
|
12 |
- uses: actions/checkout@v3
|
13 |
with:
|
14 |
fetch-depth: 0
|
15 |
-
lfs: true
|
16 |
-
|
17 |
-
- name: Install Git LFS
|
18 |
-
run: |
|
19 |
-
sudo apt-get update
|
20 |
-
sudo apt-get install git-lfs -y
|
21 |
-
git lfs install
|
22 |
-
|
23 |
-
- name: Configure Git
|
24 |
-
run: |
|
25 |
-
git config --global user.email "[email protected]"
|
26 |
-
git config --global user.name "GitHub Actions Bot"
|
27 |
-
|
28 |
-
- name: Ensure .gitattributes is correct
|
29 |
-
run: |
|
30 |
-
echo "*.sqlite3 filter=lfs diff=lfs merge=lfs -text" > .gitattributes
|
31 |
-
git add .gitattributes
|
32 |
-
git commit -m "Ensure correct LFS tracking in .gitattributes" || echo "No changes to commit"
|
33 |
-
|
34 |
-
- name: Commit large files
|
35 |
-
run: |
|
36 |
-
git add "*.sqlite3"
|
37 |
-
git commit -m "Sync large files to Hugging Face" || echo "No changes to commit"
|
38 |
-
|
39 |
-
- name: Push to Hub
|
40 |
env:
|
41 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
42 |
-
run:
|
43 |
-
git remote set-url origin https://Oxbridge-Economics:[email protected]/spaces/Oxbridge-Economics/Mailbox
|
44 |
-
git pull origin main --rebase || (git rebase --abort && git push origin main --force) # Fallback to force push if rebase fails
|
45 |
-
git push origin main
|
|
|
1 |
+
name: Sync to Hugging Face hub
|
|
|
2 |
on:
|
3 |
push:
|
4 |
branches: [main]
|
5 |
+
|
6 |
+
# to run this workflow manually from the Actions tab
|
7 |
workflow_dispatch:
|
8 |
|
9 |
jobs:
|
|
|
13 |
- uses: actions/checkout@v3
|
14 |
with:
|
15 |
fetch-depth: 0
|
16 |
+
# lfs: true
|
17 |
+
- name: Push to hub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
env:
|
19 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
20 |
+
run: git push https://OxbridegeEcon:[email protected]/spaces/Oxbridge-Economics/Mailbox main --force
|
|
|
|
|
|
.gitignore
CHANGED
@@ -174,3 +174,4 @@ cython_debug/
|
|
174 |
.pypirc
|
175 |
|
176 |
attachments
|
|
|
|
174 |
.pypirc
|
175 |
|
176 |
attachments
|
177 |
+
|