add params to prefect.yaml #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy production flows | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy-production: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Get changed requirements file | |
id: changed-files-requirements | |
uses: tj-actions/changed-files@v40 | |
with: | |
files: requirements.txt | |
- name: Get changed prefect.yaml file | |
id: changed-files-prefect | |
uses: tj-actions/changed-files@v40 | |
with: | |
files: prefect.yaml | |
- name: Login to Docker Hub | |
if: steps.changed-files-requirements.outputs.any_changed == 'true' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Run step if requirements.txt changed | |
env: | |
PREFECT_API_KEY: ${{ secrets.PREFECT_API_KEY }} | |
PREFECT_API_URL: ${{ secrets.PREFECT_API_URL }} | |
if: steps.changed-files-requirements.outputs.any_changed == 'true' | |
run: | | |
echo "Dependencies in requirements.txt have changed." | |
echo "Building and pushing docker image during deployment." | |
python select_actions.py --build build_image_prod --push push_image --pull production | |
- name: Run step if prefect.yaml changed and requriements.txt did not change | |
env: | |
PREFECT_API_KEY: ${{ secrets.PREFECT_API_KEY }} | |
PREFECT_API_URL: ${{ secrets.PREFECT_API_URL }} | |
if: steps.changed-files-prefect.outputs.any_changed == 'true' && steps.changed-files-requirements.outputs.any_changed == 'false' | |
run: | | |
echo "Dependencies in requirements.txt have not changed." | |
echo "Skipping image build and push." | |
pip install -r requirements.txt | |
python select_actions.py --build no_action --push no_action --pull production | |
prefect deploy --all |