Build dbt project documentation in meltano project on push to main, publish documentation in GitHub pages
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: Publish dbt docs to GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build_docs: | |
name: Build and upload docs artifact | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
# NOTE that we have the meltano project in a src/ subdirectory - you may not | |
working-directory: src | |
environment: | |
# TODO decide if we want to try building docs for all environments | |
name: dev | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version-file: '.python-version' | |
- name: Install Meltano | |
run: | | |
pip install meltano==2.15.0 | |
- name: Install Meltano project dependencies | |
run: | | |
meltano install | |
- name: Install dbt project dependencies | |
run: | | |
meltano invoke dbt-redshift:deps | |
- name: Generate dbt documentation | |
env: | |
MELTANO_ENVIRONMENT: dev # TODO un-hardcode this if we build docs against multiple environments | |
DBT_REDSHIFT_CLUSTER_ID: ${{ vars.PAW_REDSHIFT_CLUSTER_ID }} | |
DBT_REDSHIFT_HOST: ${{ secrets.PAW_REDSHIFT_HOST }} | |
DBT_REDSHIFT_PORT: ${{ vars.PAW_REDSHIFT_PORT }} | |
DBT_REDSHIFT_USER: ${{ secrets.READ_ONLY_REDSHIFT_USER_USERNAME }} | |
DBT_REDSHIFT_PASSWORD: ${{ secrets.READ_ONLY_REDSHIFT_USER_PASSWORD }} | |
DBT_REDSHIFT_DBNAME: staging | |
DBT_REDSHIFT_SCHEMA: staging | |
run: | | |
meltano invoke dbt-redshift:docs-generate | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
name: paw_elt_dbt_docs | |
path: src/.meltano/transformers/dbt/target | |
publish_docs: | |
name: Publish dbt docs to GitHub Pages | |
runs-on: ubuntu-20.04 | |
needs: | |
- build_docs | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: pages | |
cancel-in-progress: true | |
environment: | |
name: dev | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |
with: | |
artifact_name: paw_elt_dbt_docs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment