Skip to content

deploy-dbt-docs

deploy-dbt-docs #85

name: deploy-dbt-docs
on:
workflow_run:
workflows: [build-and-test-dbt]
branches: [master]
types: [completed]
workflow_dispatch:
jobs:
deploy-dbt-docs:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# 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: Setup dbt
uses: ./.github/actions/setup_dbt
with:
role-to-assume: ${{ secrets.AWS_IAM_ROLE_TO_ASSUME_ARN }}
- name: Setup node
uses: actions/setup-node@v3
- name: Install docs build dependencies
run: npm install -g @mermaid-js/mermaid-cli
- name: Prepare Mermaid assets for docs
run: |
for file in assets/*.mmd; do
mmdc -i "$file" -o "${file/.mmd/.svg}"
done
working-directory: ${{ env.PROJECT_DIR }}
shell: bash
- name: Generate docs
run: dbt docs generate --target prod
working-directory: ${{ env.PROJECT_DIR }}
shell: bash
- name: Package doc files for upload
run: |
mkdir -p _site/assets
for file in index.html catalog.json manifest.json; do
cp "target/$file" "_site/$file"
done
cp -R target/assets/* _site/assets
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