Skip to content

Instantly share code, notes, and snippets.

@tuanchris
Last active August 21, 2021 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuanchris/c03f8c4f9e501669fb05e2afffa0267a to your computer and use it in GitHub Desktop.
Save tuanchris/c03f8c4f9e501669fb05e2afffa0267a to your computer and use it in GitHub Desktop.
name: scheduled_run
on:
schedule:
- cron: '0 5,17 * * *'
env:
DBT_PROFILES_DIR: ./
DBT_GOOGLE_PROJECT_PROD: ${{ secrets.DBT_GOOGLE_PROJECT_PROD }}
DBT_GOOGLE_BIGQUERY_DATASET_PROD: ${{ secrets.DBT_GOOGLE_BIGQUERY_DATASET_PROD }}
# The DBT_GOOGLE_BIGQUERY_KEYFILE_PROD secret will be written to a json file below
DBT_GOOGLE_BIGQUERY_KEYFILE_PROD: ./dbt-service-account.json
jobs:
scheduled_run:
name: scheduled_run
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@master
- uses: actions/setup-python@v1
with:
python-version: "3.7.x"
- name: Authenticate using service account
run: 'echo "$KEYFILE" > ./dbt-service-account.json'
shell: bash
env:
KEYFILE: ${{secrets.DBT_GOOGLE_BIGQUERY_KEYFILE_PROD}}
- name: Install dependencies
run: |
pip install dbt
dbt deps --target prod
# Add dbt seed or other commands here if needed
- name: Run dbt models
run: dbt run --target prod
- name: Test dbt models
run: dbt test --target prod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment