daily_runs #560
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: daily_runs | |
on: | |
schedule: | |
- cron: "0 4 * * *" | |
workflow_dispatch: | |
inputs: | |
env_to_run: | |
description: The environment in which to run the job | |
default: 'stg' | |
options: | |
- prd | |
- stg | |
required: true | |
type: choice | |
env: | |
DBT_PROFILES_DIR: "." | |
jobs: | |
daily_run_stg: | |
if: contains(fromJSON('["stg", ""]'), github.event.inputs.env_to_run) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: stg | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: Save stg GCP credentials to runner | |
run: | | |
echo "${{ secrets.DBT_CICD_SA_SECRET_KEY_STG_BASE64_ENCODED }}" | base64 --decode >> ./service_account.json && \ | |
export GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/service_account.json" | |
- name: Authenticate with GCP | |
run: | | |
gcloud auth activate-service-account [email protected] --key-file=./service_account.json && \ | |
gcloud config set project beyond-basics-stg | |
- name: Install python packages | |
run: pip install -r requirements.txt | |
- name: dbt seed | |
run: dbt seed --target stg | |
env: | |
DBT_DATASET: "stg" | |
- name: dbt build | |
run: dbt build --exclude "test_type:unit" --target stg | |
env: | |
DBT_DATASET: "stg" | |
daily_run_prd: | |
if: contains(fromJSON('["prd", ""]'), github.event.inputs.env_to_run) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: prd | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
- name: Save prd GCP credentials to runner | |
run: | | |
echo "${{ secrets.DBT_CICD_SA_SECRET_KEY_PRD_BASE64_ENCODED }}" | base64 --decode >> ./service_account.json && \ | |
export GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/service_account.json" | |
- name: Authenticate with GCP | |
run: | | |
gcloud auth activate-service-account [email protected] --key-file=./service_account.json && \ | |
gcloud config set project beyond-basics-prd | |
- name: Install python packages | |
run: pip install -r requirements.txt | |
- name: dbt seed | |
run: dbt seed --target prd | |
env: | |
DBT_DATASET: "prd" | |
- name: dbt build | |
run: dbt build --exclude "test_type:unit" --target prd | |
env: | |
DBT_DATASET: "prd" |