explicit better than implicit #31
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: dbt deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
run: | |
runs-on: ubuntu-20.04 # this has the aws cli pre-installed | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- name: install requirements | |
run: pip install -q -r requirements.txt | |
- name: dbt deps | |
run: dbt deps | |
# TODO: update for your unique S3 bucket name | |
# TODO: update your GitHub secrets to include AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY | |
- name: Grab production manifest from S3 | |
run: | | |
aws s3 cp s3://vhol-datafold-dbt-prod-manifest/manifest.json ./manifest.json | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: us-west-2 | |
- name: dbt build | |
run: dbt build --target prod --select state:modified+ --defer --state ./ --exclude config.materialized:snapshot --full-refresh --profiles-dir ./ | |
env: # TODO: update your GitHub secrets to include SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, SNOWFLAKE_PASSWORD, SNOWFLAKE_ROLE | |
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} | |
SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }} | |
SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }} | |
SNOWFLAKE_ROLE: ${{ secrets.SNOWFLAKE_ROLE }} | |
# TODO: comment this step out if you don't have Datafold Cloud yet | |
# TODO: replace --ci-config-id 345 with your unique datafold ci config id | |
- name: submit artifacts to datafold | |
run: | | |
set -ex | |
datafold dbt upload --ci-config-id 345 --run-type ${DATAFOLD_RUN_TYPE} --commit-sha ${GIT_SHA} | |
env: # TODO: update your GitHub secrets to include DATAFOLD_APIKEY | |
DATAFOLD_APIKEY: ${{ secrets.DATAFOLD_APIKEY }} | |
DATAFOLD_RUN_TYPE: "${{ 'production' }}" | |
GIT_SHA: | |
"${{ github.sha }}" | |
# TODO: update for your unique S3 bucket name | |
# TODO: update your GitHub secrets to include AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY | |
- name: Upload manifest to S3 | |
run: | | |
aws s3 cp target/manifest.json s3://vhol-datafold-dbt-prod-manifest/manifest.json | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: us-west-2 |