Skip to content

Commit

Permalink
Deploy dbt docs to GitHub Pages (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeancochrane authored Aug 9, 2023
1 parent f617f52 commit 042c2a7
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 3 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/deploy_dbt_docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: deploy-dbt-docs

on:
workflow_run:
workflows: [build-and-test-dbt]
branches: [master, data-catalog]
types: [completed]
workflow_dispatch:

jobs:
deploy-dbt-docs:
runs-on: ubuntu-latest
# These permissions are required to make a GitHub Pages deployment
permissions:
pages: write # To deploy to Pages
id-token: write # To verify the deployment comes from an valid source
if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dbt requirements
uses: ./.github/actions/install_dbt_requirements

- name: Load environment variables
uses: ./.github/actions/load_environment_variables

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_IAM_ROLE_TO_ASSUME_ARN }}
aws-region: us-east-1

- name: Generate docs
# Target is currently set to CI because we expect this action to be
# run against the long-lived data-catalog branch, but we should change
# this to prod when we merge that branch into master
run: dbt docs generate --target ci
working-directory: ${{ env.PROJECT_DIR }}
shell: bash
env:
HEAD_REF: data-catalog

- name: Package doc files for upload
run: |
mkdir _site
for file in index.html catalog.json manifest.json; do
cp "target/$file" "_site/$file"
done
working-directory: ${{ env.PROJECT_DIR }}
shell: bash

- name: Upload docs directory artifact
uses: actions/upload-pages-artifact@v2
with:
path: ${{ format('{0}/_site', env.PROJECT_DIR) }}

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
6 changes: 3 additions & 3 deletions dbt/models/default/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ models:
- year
- case_no
config:
error_if: ">365894"
error_if: ">365905"
# `change` should be an enum
- dbt_utils.expression_is_true:
name: vw_pin_appeal_no_unexpected_change_values
Expand Down Expand Up @@ -111,7 +111,7 @@ models:
- mail_address_zipcode_1
- mail_address_zipcode_2
config:
error_if: ">880581"
error_if: ">880607"
# TODO: Mailing address changes after validated sale(?)
# TODO: Site addresses are all in Cook County
- name: vw_pin_condo_char_test
Expand Down Expand Up @@ -180,6 +180,6 @@ models:
group_column: year
count_column: class
config:
error_if: ">23"
error_if: ">24"
# TODO: Data completeness correlates with availability of spatial data
# by year

0 comments on commit 042c2a7

Please sign in to comment.