Skip to content

Allison dbt docs workflow #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/generate_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Generate DBT Docs

on:
push:
branches: [ "main" ]
# allows manual running
workflow_dispatch:

jobs:
generate:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dbt
run: python -m pip install dbt-core dbt-redshift

- name: Set up dbt profile
run: |
mkdir -p ~/.dbt
echo "
cdo_redshift:
target: dev
outputs:
dev:
type: redshift
host: \"${{ secrets.DBT_HOST }}\"
user: \"${{ secrets.DBT_USER }}\"
password: \"${{ secrets.DBT_PASSWORD }}\"
port: 5439
dbname: dev
schema: \"${{ secrets.DBT_DB_SCHEMA }}\"
sslmode: disable
threads: 16
ra3_node: true # see https://github.com/dbt-labs/dbt-redshift/issues/281#issuecomment-1407131697
" > ~/.dbt/profiles.yml

- name: Install dbt dependencies
working-directory: ./dbt
run: dbt deps

- name: Generate dbt docs
working-directory: ./dbt
run: dbt docs generate

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dbt/target

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: generate
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4