New examples (#181) #490
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: Generate Docs on merge to Main | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- main | |
paths: | |
- automate/* | |
- transform/* | |
- transform/**/* | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Deployment Script | |
runs-on: ubuntu-latest | |
# dbt 1.6 image | |
container: datacoves/pi7-ci-basic-base:1.9.202309122155-20230923154521 | |
defaults: | |
run: | |
working-directory: /__w/balboa/balboa/transform | |
env: | |
DBT_PROFILES_DIR: /__w/balboa/balboa/automate/dbt | |
DATACOVES__DBT_HOME: /__w/balboa/balboa/transform | |
DATACOVES__MAIN__ACCOUNT: ${{ secrets.DATACOVES__MAIN__ACCOUNT }} | |
DATACOVES__MAIN__ROLE: ${{ secrets.DATACOVES__MAIN__ROLE }} | |
DATACOVES__MAIN__WAREHOUSE: ${{ secrets.DATACOVES__MAIN__WAREHOUSE }} | |
DATACOVES__MAIN__DATABASE: BALBOA | |
DATACOVES__STAGING__DATABASE: BALBOA_STAGING | |
DATACOVES__MAIN__USER: ${{ secrets.DATACOVES__MAIN__USER }} | |
DATACOVES__MAIN__PASSWORD: ${{ secrets.DATACOVES__MAIN__PASSWORD }} | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.push.head.sha }} | |
fetch-depth: 0 | |
- name: Set Secure Directory | |
run: git config --global --add safe.directory /__w/balboa/balboa | |
- name: Install dbt packages | |
run: "dbt deps" | |
- name: Get prod manifest | |
id: prod-manifest | |
run: "../automate/dbt/get_artifacts.sh" | |
- name: Generate dbt documentation | |
run: "dbt docs generate" | |
- name: Run blue / green deployment | |
id: run-blue-green | |
env: | |
MANIFEST_FOUND: ${{ steps.prod-manifest.outputs.manifest_found }} | |
run: "../automate/blue_green_run.py --ci-cd-run -t prd" | |
- name: Drop relations in db that are no longer in dbt | |
run: "dbt run-operation drop_orphanate_relations --args '{\"dry_run\": false}'" | |
- name: Delete merged test databases | |
run: "../automate/dbt/remove_test_databases.sh" | |
- name: Deploy docs 🚀 | |
uses: JamesIves/github-pages-deploy-action@4.1.4 | |
with: | |
branch: dbt-docs | |
folder: transform/target | |
- uses: fregante/setup-git-user@v2 | |
- name: Bump dbt project and git project version | |
run: "../automate/dbt/bump_dbt_project.sh" | |
- name: Push version changes | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref_name }} | |
tags: true | |
- name: Drop staging db on Failure | |
if: always() && (steps.run-blue-green.outcome == 'failure') | |
run: "dbt --no-write-json run-operation drop_staging_db --args 'db_name: ${{env.DATACOVES__STAGING__DATABASE}}'" # yamllint disable-line rule:line-length |