dani-ange commited on
Commit
f579681
·
unverified ·
1 Parent(s): 1c0fbe6

Update train-deploy.yaml

Browse files
Files changed (1) hide show
  1. .github/workflows/train-deploy.yaml +15 -20
.github/workflows/train-deploy.yaml CHANGED
@@ -1,9 +1,10 @@
1
  name: Train and Deploy Model
 
2
  on:
3
  pull_request:
4
  branches:
5
- - master
6
- workflow_dispatch:
7
 
8
  jobs:
9
  train-evaluate-deploy:
@@ -21,38 +22,32 @@ jobs:
21
 
22
  - name: Install dependencies
23
  run: pip install -r requirements.txt
24
-
25
  - name: Upgrade Hugging Face Hub
26
  run: pip install --upgrade huggingface_hub
27
 
28
- - name: Install Git LFS
29
- run: |
30
- sudo apt-get install git-lfs
31
- git lfs install
32
-
33
  - name: Authenticate with Hugging Face
34
- env:
35
- HF_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}
36
- run: huggingface-cli login --token $HF_TOKEN --add-to-git-credential
37
 
38
- - name: Push `main` changes to `master`
39
  run: |
40
- git checkout master
41
- git pull origin master
42
- git merge --no-ff origin/main -m "Merging latest changes from main"
43
- git push origin master
 
44
  - name: Deploy to Hugging Face
45
  env:
46
  HF_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}
47
  run: |
 
48
  git config --global user.email "[email protected]"
49
  git config --global user.name "dani-ange"
50
-
51
- # Ensure Git LFS tracks the right files
52
- git lfs track "*.joblib"
53
  git add .
54
  if ! git diff --cached --exit-code; then
55
- git commit -m "Updated model"
56
  git push https://danielle2003:[email protected]/spaces/danielle2003/diabeties-ml main
57
  else
58
  echo "No changes to commit."
 
1
  name: Train and Deploy Model
2
+
3
  on:
4
  pull_request:
5
  branches:
6
+ - master # Runs when a PR is made to master
7
+ workflow_dispatch: # Allows manual triggering
8
 
9
  jobs:
10
  train-evaluate-deploy:
 
22
 
23
  - name: Install dependencies
24
  run: pip install -r requirements.txt
25
+
26
  - name: Upgrade Hugging Face Hub
27
  run: pip install --upgrade huggingface_hub
28
 
 
 
 
 
 
29
  - name: Authenticate with Hugging Face
30
+ run: |
31
+ huggingface-cli login --token "${{ secrets.HUGGINGFACE_API_TOKEN }}" --add-to-git-credential
 
32
 
33
+ - name: Merge PR changes into main
34
  run: |
35
+ git checkout main # Switch to main branch
36
+ git pull origin main # Ensure latest changes
37
+ git merge --no-ff origin/master -m "Merging PR changes from master"
38
+ git push origin main # Push merged changes to main
39
+
40
  - name: Deploy to Hugging Face
41
  env:
42
  HF_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}
43
  run: |
44
+ huggingface-cli login --token $HF_TOKEN
45
  git config --global user.email "[email protected]"
46
  git config --global user.name "dani-ange"
47
+
 
 
48
  git add .
49
  if ! git diff --cached --exit-code; then
50
+ git commit -m "Updated model after merging PR"
51
  git push https://danielle2003:[email protected]/spaces/danielle2003/diabeties-ml main
52
  else
53
  echo "No changes to commit."