Skip to content

Build an Image and Deploy a Prefect flow #25

Build an Image and Deploy a Prefect flow

Build an Image and Deploy a Prefect flow #25

name: Build an Image and Deploy a Prefect flow
on: workflow_dispatch
jobs:
deploy_flow:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Login to GAR
uses: docker/login-action@v3
with:
registry: us-east1-docker.pkg.dev
username: _json_key
password: ${{ secrets.GAR_JSON_KEY }}
- name: Prefect Auth
uses: PrefectHQ/actions-prefect-auth@v1
with:
prefect-api-key: ${{ secrets.PREFECT_API_KEY }}
prefect-workspace: ${{ secrets.PREFECT_WORKSPACE }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Activate Poetry environment
run: |
poetry shell
- name: Deploy with Prefect
run: |
prefect --no-prompt deploy --prefect-file "./prefect.yaml" --name "trigger-dbt-deploy"
# - name: Run Prefect Deploy
# uses: PrefectHQ/actions-prefect-deploy@v3
# with:
# deployment-names: trigger-dbt-deploy
# requirements-file-paths: './flows/trigger-dbt/requirements.txt'
# deployment-file-path: './prefect.yaml'