Spaces:
Sleeping
Sleeping
marintosti12 commited on
Commit ·
b4ab7b8
1
Parent(s): eed482f
fix(ci/cd) problème env / secrets
Browse files- .github/workflows/deploy.yaml +10 -15
.github/workflows/deploy.yaml
CHANGED
|
@@ -14,29 +14,24 @@ concurrency:
|
|
| 14 |
jobs:
|
| 15 |
deploy:
|
| 16 |
runs-on: ubuntu-latest
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
steps:
|
| 20 |
-
|
| 21 |
-
- name: Checkout
|
| 22 |
-
uses: actions/checkout@v4
|
| 23 |
|
| 24 |
-
# Configuration Git (ne sert à rien si secrets absents, on le conditionne aussi)
|
| 25 |
- name: Configure Git
|
| 26 |
-
if: ${{ secrets.HF_TOKEN && secrets.HF_SPACE_URL }}
|
| 27 |
run: |
|
| 28 |
git config --global user.email "${{ secrets.HF_GIT_EMAIL || 'actions@github.com' }}"
|
| 29 |
git config --global user.name "${{ secrets.HF_GIT_NAME || 'github-actions' }}"
|
| 30 |
git lfs install
|
| 31 |
|
| 32 |
-
|
| 33 |
-
- name: Add space Hugging Face
|
| 34 |
-
if: ${{ secrets.HF_TOKEN && secrets.HF_SPACE_URL }}
|
| 35 |
run: |
|
| 36 |
-
SPACE_URL_AUTH=$(echo "$
|
| 37 |
git remote add space "$SPACE_URL_AUTH" || git remote set-url space "$SPACE_URL_AUTH"
|
| 38 |
-
|
| 39 |
-
# Push pour déclencher le build & déploiement
|
| 40 |
-
- name: Push to Space
|
| 41 |
-
if: ${{ secrets.HF_TOKEN && secrets.HF_SPACE_URL }}
|
| 42 |
-
run: git push space HEAD:main --force
|
|
|
|
| 14 |
jobs:
|
| 15 |
deploy:
|
| 16 |
runs-on: ubuntu-latest
|
| 17 |
+
env:
|
| 18 |
+
HF_TOKEN: ${{ secrets.HF_TOKEN || '' }}
|
| 19 |
+
HF_SPACE_URL: ${{ secrets.HF_SPACE_URL || '' }}
|
| 20 |
+
|
| 21 |
+
# déploie seulement si la CI est "success" ET si les secrets existent
|
| 22 |
+
if: ${{ github.event.workflow_run.conclusion == 'success' && env.HF_TOKEN != '' && env.HF_SPACE_URL != '' }}
|
| 23 |
|
| 24 |
steps:
|
| 25 |
+
- uses: actions/checkout@v4
|
|
|
|
|
|
|
| 26 |
|
|
|
|
| 27 |
- name: Configure Git
|
|
|
|
| 28 |
run: |
|
| 29 |
git config --global user.email "${{ secrets.HF_GIT_EMAIL || 'actions@github.com' }}"
|
| 30 |
git config --global user.name "${{ secrets.HF_GIT_NAME || 'github-actions' }}"
|
| 31 |
git lfs install
|
| 32 |
|
| 33 |
+
- name: Push to Space
|
|
|
|
|
|
|
| 34 |
run: |
|
| 35 |
+
SPACE_URL_AUTH=$(echo "$HF_SPACE_URL" | sed "s#https://#https://user:${HF_TOKEN}@#")
|
| 36 |
git remote add space "$SPACE_URL_AUTH" || git remote set-url space "$SPACE_URL_AUTH"
|
| 37 |
+
git push space HEAD:main --force
|
|
|
|
|
|
|
|
|
|
|
|