Spaces:
Sleeping
Sleeping
marintosti12 commited on
Commit ·
eed482f
1
Parent(s): 0bc3c61
fix(cd) : fix problème secrets
Browse files
.github/workflows/deploy.yaml
CHANGED
|
@@ -2,37 +2,41 @@ name: Deploy to Hugging Face
|
|
| 2 |
|
| 3 |
on:
|
| 4 |
workflow_run:
|
| 5 |
-
workflows: ["CI"]
|
| 6 |
branches: [ main ]
|
| 7 |
types: [completed]
|
| 8 |
workflow_dispatch: {}
|
| 9 |
-
|
| 10 |
concurrency:
|
| 11 |
-
group: deploy-${{ github.
|
| 12 |
cancel-in-progress: true
|
| 13 |
|
| 14 |
jobs:
|
| 15 |
deploy:
|
| 16 |
runs-on: ubuntu-latest
|
| 17 |
-
if: ${{
|
| 18 |
-
steps:
|
| 19 |
|
| 20 |
-
|
|
|
|
| 21 |
- name: Checkout
|
| 22 |
uses: actions/checkout@v4
|
| 23 |
|
| 24 |
-
# Configuration Git
|
| 25 |
- name: Configure Git
|
|
|
|
| 26 |
run: |
|
| 27 |
git config --global user.email "${{ secrets.HF_GIT_EMAIL || 'actions@github.com' }}"
|
| 28 |
git config --global user.name "${{ secrets.HF_GIT_NAME || 'github-actions' }}"
|
| 29 |
git lfs install
|
| 30 |
|
| 31 |
-
# Ajout
|
| 32 |
- name: Add space Hugging Face
|
|
|
|
| 33 |
run: |
|
| 34 |
SPACE_URL_AUTH=$(echo "${{ secrets.HF_SPACE_URL }}" | sed "s#https://#https://user:${{ secrets.HF_TOKEN }}@#")
|
| 35 |
git remote add space "$SPACE_URL_AUTH" || git remote set-url space "$SPACE_URL_AUTH"
|
| 36 |
|
|
|
|
| 37 |
- name: Push to Space
|
|
|
|
| 38 |
run: git push space HEAD:main --force
|
|
|
|
| 2 |
|
| 3 |
on:
|
| 4 |
workflow_run:
|
| 5 |
+
workflows: ["CI"]
|
| 6 |
branches: [ main ]
|
| 7 |
types: [completed]
|
| 8 |
workflow_dispatch: {}
|
| 9 |
+
|
| 10 |
concurrency:
|
| 11 |
+
group: deploy-${{ github.event.workflow_run.head_branch || 'main' }}
|
| 12 |
cancel-in-progress: true
|
| 13 |
|
| 14 |
jobs:
|
| 15 |
deploy:
|
| 16 |
runs-on: ubuntu-latest
|
| 17 |
+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
|
|
| 18 |
|
| 19 |
+
steps:
|
| 20 |
+
# Récupération du code
|
| 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 |
+
# Ajout du remote vers Hugging Face
|
| 33 |
- name: Add space Hugging Face
|
| 34 |
+
if: ${{ secrets.HF_TOKEN && secrets.HF_SPACE_URL }}
|
| 35 |
run: |
|
| 36 |
SPACE_URL_AUTH=$(echo "${{ secrets.HF_SPACE_URL }}" | sed "s#https://#https://user:${{ secrets.HF_TOKEN }}@#")
|
| 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
|