File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 steps :
77 - name : Checkout Repository
88 uses : actions/checkout@v3
9+
910 - name : Setup Python und install requirements
1011 uses : actions/setup-python@v4
1112 with :
1213 python-version : " 3.8"
1314 - run : pip install -r requirements.txt
15+
1416 - name : Train model
1517 run : python src/train.py
18+
1619 - name : Upload trained model
1720 uses : actions/upload-artifact@v4
1821 with :
Original file line number Diff line number Diff line change 1+ name : Deploy to Production
2+ on :
3+ push :
4+ branches :
5+ - main
6+
7+ jobs :
8+ train-model :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - uses : actions/checkout@v2
12+ - name : Switch to heroku branch
13+ shell : bash
14+ run : |
15+ git config --global user.email ""
16+ git config --global user.name "Github Actions"
17+ git fetch --all --unshallow
18+ git checkout heroku 2>/dev/null || git checkout -b heroku
19+ git merge main -X theirs --allow-unrelated-histories
20+
21+ - name : Set up Python
22+ uses : actions/setup-python@v2
23+ with :
24+ python-version : " 3.9"
25+
26+ - name : Install dependencies
27+ run : pip install -r requirements.txt
28+
29+ - name : Train model
30+ run : python src/train.py
31+
32+ - name : Upload trained model
33+ uses : actions/upload-artifact@v4
34+ with :
35+ name : regressor_mpg.pickle
36+ path : data/models/regressor_mpg.pickle
37+
38+ - name : Push changes to heroku branch
39+ shell : bash
40+ run : |
41+ git add .
42+ git add --force data/models/regressor_mpg.pickle
43+ git commit -m "[CI] update trained model" || echo "No changes to commit"
44+ git push --set-upstream origin heroku
45+
46+ - name : Deploy to Heroku
47+ uses : akhileshns/heroku-deploy@v3.13.15
48+ with :
49+ heroku_api_key : ${{secrets.HEROKU_API_KEY}}
50+ heroku_app_name : ${{secrets.HEROKU_APP_NAME}}
51+ heroku_email : ${{secrets.HEROKU_EMAIL}}
52+ branch : " heroku"
Original file line number Diff line number Diff line change 1+ web : gunicorn src.api:app
You can’t perform that action at this time.
0 commit comments