eliminate redundancy
Browse files- .github/workflows/main.yml +14 -32
.github/workflows/main.yml
CHANGED
|
@@ -12,60 +12,42 @@ jobs:
|
|
| 12 |
# Step 1: Checkout the repository with full history and LFS support
|
| 13 |
- uses: actions/checkout@v3
|
| 14 |
with:
|
| 15 |
-
fetch-depth: 0
|
| 16 |
-
lfs: true
|
| 17 |
|
| 18 |
-
# Step 2:
|
| 19 |
-
- name: Install Latest Git LFS
|
| 20 |
-
run: |
|
| 21 |
-
# Remove any existing Git LFS installation
|
| 22 |
-
sudo apt-get remove git-lfs || true
|
| 23 |
-
|
| 24 |
-
# Add the Git LFS repository
|
| 25 |
-
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
|
| 26 |
-
|
| 27 |
-
# Install Git LFS
|
| 28 |
-
sudo apt-get install git-lfs
|
| 29 |
-
|
| 30 |
-
# Initialize Git LFS
|
| 31 |
-
git lfs install
|
| 32 |
-
|
| 33 |
-
# Step 3: Configure Git User
|
| 34 |
- name: Configure Git User
|
| 35 |
run: |
|
| 36 |
git config --global user.email "alexandru.dumitrescu@gmail.com"
|
| 37 |
git config --global user.name "alexdum"
|
| 38 |
|
| 39 |
-
# Step
|
| 40 |
- name: Track .nc Files with Git LFS
|
| 41 |
run: |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
- name: Migrate Existing .nc Files to Git LFS
|
| 48 |
-
run: |
|
| 49 |
-
git lfs migrate import --include="*.nc" --everything
|
| 50 |
|
| 51 |
-
# Step
|
| 52 |
- name: Add and Commit LFS-tracked Files
|
| 53 |
run: |
|
| 54 |
git add .
|
| 55 |
-
git commit -m "Move .nc files to Git LFS"
|
| 56 |
|
| 57 |
-
# Step
|
| 58 |
- name: Verify LFS Tracking
|
| 59 |
run: git lfs ls-files
|
| 60 |
|
| 61 |
-
# Step
|
| 62 |
- name: Add Hugging Face Remote
|
| 63 |
env:
|
| 64 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 65 |
run: |
|
| 66 |
git remote add hf https://alexdum:${HF_TOKEN}@huggingface.co/spaces/alexdum/roclihom
|
| 67 |
|
| 68 |
-
# Step
|
| 69 |
- name: Force Push to Hugging Face Hub
|
| 70 |
env:
|
| 71 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
|
|
|
| 12 |
# Step 1: Checkout the repository with full history and LFS support
|
| 13 |
- uses: actions/checkout@v3
|
| 14 |
with:
|
| 15 |
+
fetch-depth: 0
|
| 16 |
+
lfs: true
|
| 17 |
|
| 18 |
+
# Step 2: Configure Git User (necessary for commits)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
- name: Configure Git User
|
| 20 |
run: |
|
| 21 |
git config --global user.email "alexandru.dumitrescu@gmail.com"
|
| 22 |
git config --global user.name "alexdum"
|
| 23 |
|
| 24 |
+
# Step 3: Track .nc Files with Git LFS if not already tracked
|
| 25 |
- name: Track .nc Files with Git LFS
|
| 26 |
run: |
|
| 27 |
+
if ! grep -q "*.nc" .gitattributes; then
|
| 28 |
+
git lfs track "*.nc"
|
| 29 |
+
git add .gitattributes
|
| 30 |
+
git commit -m "Configure Git LFS for all .nc files"
|
| 31 |
+
fi
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
# Step 4: Add and Commit Any LFS-tracked Files (only if there are changes)
|
| 34 |
- name: Add and Commit LFS-tracked Files
|
| 35 |
run: |
|
| 36 |
git add .
|
| 37 |
+
git diff-index --quiet HEAD || git commit -m "Move .nc files to Git LFS"
|
| 38 |
|
| 39 |
+
# Step 5: Verify LFS Tracking
|
| 40 |
- name: Verify LFS Tracking
|
| 41 |
run: git lfs ls-files
|
| 42 |
|
| 43 |
+
# Step 6: Add Hugging Face Remote
|
| 44 |
- name: Add Hugging Face Remote
|
| 45 |
env:
|
| 46 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 47 |
run: |
|
| 48 |
git remote add hf https://alexdum:${HF_TOKEN}@huggingface.co/spaces/alexdum/roclihom
|
| 49 |
|
| 50 |
+
# Step 7: Force Push to Hugging Face Hub
|
| 51 |
- name: Force Push to Hugging Face Hub
|
| 52 |
env:
|
| 53 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|