chaton59 commited on
Commit
2ad8ec9
·
1 Parent(s): 4114067

fix: secure CI/CD YAML with secrets (no hardcode tokens)

Browse files
Files changed (3) hide show
  1. .github/workflows/ci-cd.yml +5 -5
  2. README.md +6 -6
  3. docs/pipeline.md +1 -1
.github/workflows/ci-cd.yml CHANGED
@@ -19,7 +19,7 @@ jobs:
19
  uses: actions/cache@v4
20
  with:
21
  path: ~/.cache/pip
22
- key: $$ {{ runner.os }}-pip- $${{ hashFiles('requirements.txt') }}
23
  - name: Install dependencies
24
  run: |
25
  python -m pip install --upgrade pip
@@ -43,12 +43,12 @@ jobs:
43
  - name: Deploy to HF Spaces # Étape 7 : Push vers oc_p5 (dev/main)
44
  uses: huggingface/huggingface-hub@v4 # Action HF pour auth/push facile (simule git push hf)
45
  env:
46
- HUGGINGFACE_TOKEN: ${{ secrets.HF_TOKEN }} # Secret (2.4)
47
  with:
48
  huggingface_repo: ASI-Engineer/oc_p5 # Ton Space dev (crée oc_p5-prod pour main si besoin)
49
  repo_type: space # Type Space (pas model)
50
- - name: Fallback git push to HF # Si hub fail (ton remote hf backup)
51
  run: |
52
  git remote add hf https://huggingface.co/spaces/ASI-Engineer/oc_p5 || true
53
- git config --global url."https://${{ secrets.HF_TOKEN }}@huggingface.co".insteadOf "https://huggingface.co"
54
- git push hf HEAD:${{ github.ref_name }} # Push branche courante
 
19
  uses: actions/cache@v4
20
  with:
21
  path: ~/.cache/pip
22
+ key: $$ {{ runner.os }}-pip- $${{ hashFiles('requirements.txt') }} # Fix indent/key
23
  - name: Install dependencies
24
  run: |
25
  python -m pip install --upgrade pip
 
43
  - name: Deploy to HF Spaces # Étape 7 : Push vers oc_p5 (dev/main)
44
  uses: huggingface/huggingface-hub@v4 # Action HF pour auth/push facile (simule git push hf)
45
  env:
46
+ HUGGINGFACE_TOKEN: ${{ secrets.HF_TOKEN }} # Secret GitHub (2.4)
47
  with:
48
  huggingface_repo: ASI-Engineer/oc_p5 # Ton Space dev (crée oc_p5-prod pour main si besoin)
49
  repo_type: space # Type Space (pas model)
50
+ - name: Fallback git push to HF # Si hub fail (ton remote hf backup, sans hardcode)
51
  run: |
52
  git remote add hf https://huggingface.co/spaces/ASI-Engineer/oc_p5 || true
53
+ git config --global url."https://${{ secrets.HF_TOKEN }}@huggingface.co".insteadOf "https://huggingface.co" # Token secret injecté
54
+ git push hf HEAD:${{ github.ref_name }} # Push branche courante
README.md CHANGED
@@ -1,11 +1,11 @@
1
  ---
2
- title: OC P5 - API ML Déployée # Titre descriptif pour démo Aurélien
3
- emoji: 🚀 # Icône visuelle (optionnel, fun pour UI Space)
4
- colorFrom: blue # Gradient couleur (bleu → violet pour thématique IA)
5
  colorTo: purple
6
- sdk: static # Ton SDK choisi (pour FastAPI pur, vs gradio pour UI)
7
- app_file: app.py # Pointe vers fichier API (créé étape 3 ; placeholder pour POC)
8
- pinned: false # Pas épinglé dashboard (évolutif)
9
  ---
10
 
11
  # ML Deployment Project
 
1
  ---
2
+ title: OC P5 - API ML Déployée
3
+ emoji: 🚀
4
+ colorFrom: blue
5
  colorTo: purple
6
+ sdk: static
7
+ app_file: app.py
8
+ pinned: false
9
  ---
10
 
11
  # ML Deployment Project
docs/pipeline.md CHANGED
@@ -26,7 +26,7 @@ Automatiser tests (qualité code/ML) et déploiement vers Hugging Face Spaces po
26
  *Choix : Conditionnel par branche ; utilise secrets pour HF_TOKEN (sécurité).*
27
 
28
  ## Gestion Envs et Secrets
29
- - **Devs** : Branche `dev` → Space `ton-username/espace-dev` (tests rapides).
30
  - **Test/Prod** : PR → `main` → Space `espace-prod` (review requise).
31
  - **Secrets** : HF_TOKEN (GitHub Secrets) ; jamais en code.
32
  *Choix : Sépare envs pour traçabilité (inputs/outputs ML en DB PostgreSQL plus tard).*
 
26
  *Choix : Conditionnel par branche ; utilise secrets pour HF_TOKEN (sécurité).*
27
 
28
  ## Gestion Envs et Secrets
29
+ - **Devs** : Branche `dev` → Space `ASI-Engineer/oc_p5` (tests rapides).
30
  - **Test/Prod** : PR → `main` → Space `espace-prod` (review requise).
31
  - **Secrets** : HF_TOKEN (GitHub Secrets) ; jamais en code.
32
  *Choix : Sépare envs pour traçabilité (inputs/outputs ML en DB PostgreSQL plus tard).*