Skip to content

change python version (#10) #3

change python version (#10)

change python version (#10) #3

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.10"
- 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: Install Heroku CLI
run: |
curl https://cli-assets.heroku.com/install.sh | sh
- 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"