Automate Docs Generate (#21)

* first pass

* test 2

* test 3

* test 4

* test 5

* test 6

* test 6

* test 7

* test 8

* test 9

* test 10

* test 11

* repo token test

* token test 2

* token test 3

* token test 4

* token test 5

* Auto-update docs

* removed with on checkout test

* testing file move

* mkdir command

* no spaces

* Auto-update docs

* update gitignore for target again

* Auto-update docs

* clean target

* Auto-update docs

* will it delete user.yml

* Auto-update docs

* test profile as env

* echo echo

* space

* secretS

* nope, only encrypted

* Auto-update docs

* clean up test profile

* Auto-update docs

* pythonless test

* Auto-update docs

* del blank line

* jk keep python

Co-authored-by: github-actions <abc@xyz>
This commit is contained in:
Jack Forgash 2022-05-24 18:34:03 -06:00 committed by GitHub
parent a956618336
commit f7fe080eef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 104 additions and 16 deletions

29
.dbt/profiles.yml Normal file
View File

@ -0,0 +1,29 @@
flow:
target: dev
outputs:
dev:
type: snowflake
account: "{{ env_var('ACCOUNT') }}"
role: "{{ env_var('ROLE') }}"
user: "{{ env_var('USER') }}"
password: "{{ env_var('PASSWORD') }}"
region: "{{ env_var('REGION') }}"
database: "{{ env_var('DATABASE_DEV') }}"
warehouse: "{{ env_var('WAREHOUSE_DEV') }}"
schema: SILVER
threads: 4
client_session_keep_alive: False
query_tag: gh_actions
prod:
type: snowflake
account: "{{ env_var('ACCOUNT') }}"
role: "{{ env_var('ROLE') }}"
user: "{{ env_var('USER') }}"
password: "{{ env_var('PASSWORD') }}"
region: "{{ env_var('REGION') }}"
database: "{{ env_var('DATABASE_PROD') }}"
warehouse: "{{ env_var('WAREHOUSE_PROD') }}"
schema: silver
threads: 4
client_session_keep_alive: False
query_tag: gh_actions

62
.github/workflows/docs_update.yml vendored Normal file
View File

@ -0,0 +1,62 @@
name: docs_update
on:
push:
branches:
- 'main'
env:
ACCOUNT: '${{ secrets.ACCOUNT }}'
ROLE: '${{ secrets.ROLE }}'
USER: '${{ secrets.USER }}'
PASSWORD: '${{ secrets.PASSWORD }}'
REGION: '${{ secrets.REGION }}'
DATABASE_DEV: '${{ secrets.DATABASE_DEV }}'
DATABASE_PROD: '${{ secrets.DATABASE_PROD }}'
WAREHOUSE_DEV: '${{ secrets.WAREHOUSE_DEV }}'
WAREHOUSE_PROD: '${{ secrets.WAREHOUSE_PROD }}'
jobs:
scheduled_run:
name: docs_update
runs-on: ubuntu-latest
steps:
- name: check out main
uses: actions/checkout@main
- uses: actions/setup-python@v1
with:
python-version: "3.7.x"
- name: install dependencies
run: |
pip install dbt-snowflake
dbt deps
- name: generate dbt docs
run: dbt docs generate --profiles-dir ./.dbt
- name: move to docs directory
run: |
mkdir -p ./docs
cp target/{catalog.json,manifest.json,index.html} docs/
- name: clean up target directory
run: dbt clean
- name: check for changes
run: git status
- name: stage changed files
run: git add .
- name: commit changed files
run: |
git config user.email "abc@xyz"
git config user.name "github-actions"
git commit -am "Auto-update docs"
- name: push changes to main
run: git push origin HEAD:main

5
.gitignore vendored
View File

@ -15,7 +15,4 @@ logs/
**/.DS_Store
.vscode/
# carve out docs files
!target/index.html
!target/catalog.json
!target/manifest.json
.dbt/.user.yml

1
docs/catalog.json Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
docs/manifest.json Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long