-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (99 loc) · 3.13 KB
/
transformations_docs_deploy.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
91
92
93
94
95
96
97
98
99
100
101
102
name: Deploy dbt docs
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
CLOUDQUERY_API_KEY: ${{ secrets.CLOUDQUERY_API_KEY }}
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
generate-docs:
runs-on: ubuntu-latest
strategy:
matrix:
shard: [
1, 2, 3, 4,
5, 6, 7, 8,
9, 10
]
timeout-minutes: 30
services:
postgres:
image: postgres:11
env:
POSTGRES_PASSWORD: pass
POSTGRES_USER: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install dbt packages
run: pip install dbt-postgres
- name: Setup CloudQuery
uses: cloudquery/setup-cloudquery@v4
with:
version: v6.4.1
- name: Generate the docs
run: make shard=${{ matrix.shard }} gen-site
env:
CQ_DSN: postgresql://postgres:pass@localhost:5432/postgres
- uses: actions/upload-artifact@v4
with:
name: docs-artifact-${{ matrix.shard }}
path: "*.html"
deploy-preview:
if: github.event_name == 'pull_request'
needs: generate-docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: docs-artifact-*
path: actions-checkout-file-path
merge-multiple: true
- run: mv actions-checkout-file-path/*.html dbt-docs-site
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --no-wait --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
deploy-prod:
if: github.event_name == 'push'
needs: generate-docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: docs-artifact-*
path: actions-checkout-file-path
merge-multiple: true
- run: mv actions-checkout-file-path/*.html dbt-docs-site
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prod --no-wait --prebuilt --token=${{ secrets.VERCEL_TOKEN }}