-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.47 KB
/
production-deployment.yml
File metadata and controls
52 lines (45 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Deploy to Production
on:
push:
branches:
- main
jobs:
train-model:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Switch to heroku branch
shell: bash
run: |
git config --global user.email ""
git config --global user.name "Github Actions"
git fetch --all --unshallow
git checkout heroku 2>/dev/null || git checkout -b heroku
git merge main -X theirs --allow-unrelated-histories
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Train model
run: python src/train.py
- name: Upload trained model
uses: actions/upload-artifact@v4
with:
name: regressor_mpg.pickle
path: data/models/regressor_mpg.pickle
- name: Push changes to heroku branch
shell: bash
run: |
git add .
git add --force data/models/regressor_mpg.pickle
git commit -m "[CI] update trained model" || echo "No changes to commit"
git push --set-upstream origin heroku
- name: Deploy to Heroku
uses: akhileshns/heroku-deploy@v3.13.15
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{secrets.HEROKU_APP_NAME}}
heroku_email: ${{secrets.HEROKU_EMAIL}}
branch: "heroku"