Commit ·
3822800
1
Parent(s): 00ecb58
test2 ci/cd
Browse files
.github/workflows/deploy_hf_space.yml
CHANGED
|
@@ -29,15 +29,14 @@ jobs:
|
|
| 29 |
sudo apt-get install -y git-lfs
|
| 30 |
git lfs install
|
| 31 |
|
| 32 |
-
- name: Remove large model files from commit
|
| 33 |
-
# Prevent accidental pushing of the models dir; do NOT delete local files
|
| 34 |
run: |
|
| 35 |
git rm -r --cached models || true
|
| 36 |
echo "models/" >> .gitignore || true
|
| 37 |
git add .gitignore || true
|
| 38 |
git commit -m "ci: ignore models (don't push large model artifacts)" || true
|
| 39 |
|
| 40 |
-
- name: Ensure .gitattributes for images
|
| 41 |
run: |
|
| 42 |
git lfs track "images/**" || true
|
| 43 |
echo "images/** filter=lfs diff=lfs merge=lfs -text" >> .gitattributes || true
|
|
@@ -46,7 +45,6 @@ jobs:
|
|
| 46 |
|
| 47 |
- name: Prepare repository for push
|
| 48 |
run: |
|
| 49 |
-
# Keep repo clean / commit any incidental changes
|
| 50 |
git add -A
|
| 51 |
git diff --cached --quiet || git commit -m "ci: pre-deploy commit" || echo "no changes"
|
| 52 |
|
|
@@ -54,17 +52,16 @@ jobs:
|
|
| 54 |
env:
|
| 55 |
HF_USERNAME: ${{ secrets.HF_USERNAME }}
|
| 56 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 57 |
-
HF_SPACE_REPO: ${{ secrets.HF_SPACE_REPO }}
|
| 58 |
run: |
|
| 59 |
if [ -z "$HF_USERNAME" ] || [ -z "$HF_TOKEN" ] || [ -z "$HF_SPACE_REPO" ]; then
|
| 60 |
-
echo "ERROR:
|
| 61 |
exit 1
|
| 62 |
fi
|
| 63 |
-
|
| 64 |
git remote remove hf-space || true
|
| 65 |
git remote add hf-space "https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE_REPO}.git"
|
| 66 |
-
# push all files (force to ensure sync)
|
| 67 |
git push --force hf-space HEAD:main
|
| 68 |
|
| 69 |
- name: Done
|
| 70 |
-
run: echo "Pushed to Hugging Face Space
|
|
|
|
| 29 |
sudo apt-get install -y git-lfs
|
| 30 |
git lfs install
|
| 31 |
|
| 32 |
+
- name: Remove large model files from commit
|
|
|
|
| 33 |
run: |
|
| 34 |
git rm -r --cached models || true
|
| 35 |
echo "models/" >> .gitignore || true
|
| 36 |
git add .gitignore || true
|
| 37 |
git commit -m "ci: ignore models (don't push large model artifacts)" || true
|
| 38 |
|
| 39 |
+
- name: Ensure .gitattributes for images
|
| 40 |
run: |
|
| 41 |
git lfs track "images/**" || true
|
| 42 |
echo "images/** filter=lfs diff=lfs merge=lfs -text" >> .gitattributes || true
|
|
|
|
| 45 |
|
| 46 |
- name: Prepare repository for push
|
| 47 |
run: |
|
|
|
|
| 48 |
git add -A
|
| 49 |
git diff --cached --quiet || git commit -m "ci: pre-deploy commit" || echo "no changes"
|
| 50 |
|
|
|
|
| 52 |
env:
|
| 53 |
HF_USERNAME: ${{ secrets.HF_USERNAME }}
|
| 54 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 55 |
+
HF_SPACE_REPO: ${{ secrets.HF_SPACE_REPO }}
|
| 56 |
run: |
|
| 57 |
if [ -z "$HF_USERNAME" ] || [ -z "$HF_TOKEN" ] || [ -z "$HF_SPACE_REPO" ]; then
|
| 58 |
+
echo "ERROR: Missing secrets HF_USERNAME, HF_TOKEN, HF_SPACE_REPO"
|
| 59 |
exit 1
|
| 60 |
fi
|
| 61 |
+
|
| 62 |
git remote remove hf-space || true
|
| 63 |
git remote add hf-space "https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_SPACE_REPO}.git"
|
|
|
|
| 64 |
git push --force hf-space HEAD:main
|
| 65 |
|
| 66 |
- name: Done
|
| 67 |
+
run: echo "Pushed to Hugging Face Space"
|