-
Notifications
You must be signed in to change notification settings - Fork 1
90 lines (79 loc) · 2.63 KB
/
generate_docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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: Hide unnecessary parts of docs
run: python .github/hide_docs.py
- name: Add custom styling
working-directory: ./dbt/target
run: |
echo "
.logo {
background-image: url(https://code.org/images/logo.svg);
background-color: transparent;
background-repeat: no-repeat;
background-size: contain;
}
img.logo {
display: none;
}
" > styling.css
sed -i 's|<head>|<head><link rel="stylesheet" type="text/css" href="styling.css" />|g' index.html
sed -i 's|<title>dbt Docs</title>|<title>Code.org dbt Docs</title>|g' index.html
sed -i "s|\${require('./assets/favicons/favicon.ico')}|https://code.org/images/logo.svg|g" index.html
- 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