Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/dbt-cd-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: dbt prod Deploy

on:
push:
branches: [ "master" ] # runs after PR merge (push to master)
workflow_dispatch:

concurrency:
group: dbt-prod
cancel-in-progress: false

jobs:
dbt-run:
runs-on: ubuntu-latest
environment: DBT_MI
defaults:
run:
working-directory: marketing_insights

env:
DBT_PRIVATE_KEY: ${{ secrets.DBT_PRIVATE_KEY }}
DBT_PRIVATE_KEY_PATH: /home/runner/.dbt/rsa_key.p8
DBT_SNOWFLAKE_ACCOUNT: ${{ secrets.DBT_SNOWFLAKE_ACCOUNT }}
DBT_SNOWFLAKE_ROLE: ${{ secrets.DBT_SNOWFLAKE_ROLE }}
DBT_SNOWFLAKE_USER: ${{ secrets.DBT_SNOWFLAKE_USER }}
DBT_SCHEMA: pr_${{ github.event.pull_request.number }}_ANALYTICS

steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0 # needed so we can access master too

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12.13"

- name: Install dbt
run: |
python -m pip install --upgrade pip
pip install dbt-core==1.11.8 dbt-snowflake==1.11.4

- name: Set up dbt profile + private key
run: |
mkdir -p ~/.dbt
cp .dbt/profiles.yml ~/.dbt/profiles.yml
echo "$DBT_PRIVATE_KEY" > ~/.dbt/rsa_key.p8
chmod 600 ~/.dbt/rsa_key.p8

- name: dbt deps
run: dbt deps --target prod

- name: dbt seed
run: dbt seed --target prod

- name: dbt compile
run: dbt compile --target prod

- name: dbt build (prod)
run: dbt build --target prod
Loading