marintosti12 commited on
Commit
fe60404
·
1 Parent(s): ea130a9

feat(CD) : Création fichier deploy pour Huggings Face

Browse files
Files changed (1) hide show
  1. .github/workflows/deploy.yaml +36 -0
.github/workflows/deploy.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy to Hugging Face
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ workflow_dispatch: {}
7
+
8
+ concurrency:
9
+ group: deploy-${{ github.ref }}
10
+ cancel-in-progress: true
11
+
12
+ jobs:
13
+ deploy:
14
+ runs-on: ubuntu-latest
15
+ if: ${{ secrets.HF_TOKEN != '' && secrets.HF_SPACE_URL != '' }}
16
+ steps:
17
+
18
+ # Récuperation du code dans un runner
19
+ - name: Checkout
20
+ uses: actions/checkout@v4
21
+
22
+ # Configuration Git
23
+ - name: Configure Git
24
+ run: |
25
+ git config --global user.email "${{ secrets.HF_GIT_EMAIL || 'actions@github.com' }}"
26
+ git config --global user.name "${{ secrets.HF_GIT_NAME || 'github-actions' }}"
27
+ git lfs install
28
+
29
+ # Ajout des remotes vers Hugging face
30
+ - name: Add space Hugging Face
31
+ run: |
32
+ SPACE_URL_AUTH=$(echo "${{ secrets.HF_SPACE_URL }}" | sed "s#https://#https://user:${{ secrets.HF_TOKEN }}@#")
33
+ git remote add space "$SPACE_URL_AUTH" || git remote set-url space "$SPACE_URL_AUTH"
34
+
35
+ - name: Push to Space
36
+ run: git push space HEAD:main --force