Skip to content

Commit 822fbbc

Browse files
committed
ci(docs): add v2 draft workflow for parallel doc build validation
Add netlify-deploy-v2.yaml that runs the new parallel matrix architecture (discover → generate per-version → assemble + Hugo build) but deploys as a Netlify draft (no --prod flag). This allows validating the new build pipeline side-by-side with the existing production workflow without any risk to the live site. jira: trivial risk: nonprod
1 parent b7a0c56 commit 822fbbc

1 file changed

Lines changed: 134 additions & 0 deletions

File tree

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Netlify Deploy V2 (Draft)
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
# Job 1: Discover which version branches to build
7+
discover-versions:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
matrix: ${{ steps.versions.outputs.matrix }}
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
- name: Fetch remote refs
15+
run: git fetch origin
16+
- name: Discover versions
17+
id: versions
18+
run: |
19+
MATRIX=$(bash scripts/discover-versions.sh origin 4)
20+
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
21+
echo "Discovered versions: $MATRIX"
22+
23+
# Job 2: Generate docs for each version (matrix — runs in parallel across versions)
24+
# Each version gets its own runner with that branch's SDK installed.
25+
# Per-version caching means released branches (which rarely change) are instant cache hits.
26+
generate-version:
27+
needs: [discover-versions]
28+
runs-on: ubuntu-latest
29+
strategy:
30+
matrix:
31+
version: ${{ fromJson(needs.discover-versions.outputs.matrix) }}
32+
fail-fast: false
33+
steps:
34+
- name: Get branch commit SHA
35+
id: sha
36+
env:
37+
GH_TOKEN: ${{ github.token }}
38+
run: |
39+
SHA=$(gh api "repos/${{ github.repository }}/git/ref/heads/${{ matrix.version.branch }}" -q '.object.sha')
40+
echo "sha=$SHA" >> $GITHUB_OUTPUT
41+
echo "Branch ${{ matrix.version.branch }} -> section ${{ matrix.version.section }} (SHA: $SHA)"
42+
- name: Cache version docs
43+
id: cache
44+
uses: actions/cache@v4
45+
with:
46+
path: docs/versioned_docs/${{ matrix.version.section }}
47+
key: version-docs-${{ matrix.version.section }}-${{ steps.sha.outputs.sha }}
48+
- name: Checkout
49+
if: steps.cache.outputs.cache-hit != 'true'
50+
uses: actions/checkout@v4
51+
- name: Fetch target branch
52+
if: steps.cache.outputs.cache-hit != 'true'
53+
run: git fetch origin ${{ matrix.version.branch }}
54+
- name: Checkout branch packages
55+
if: steps.cache.outputs.cache-hit != 'true'
56+
run: |
57+
git checkout origin/${{ matrix.version.branch }} -- gooddata-api-client/ packages/gooddata-sdk/ packages/gooddata-pandas/ scripts/script-requirements.txt
58+
- name: Setup Python
59+
if: steps.cache.outputs.cache-hit != 'true'
60+
uses: actions/setup-python@v5
61+
with:
62+
python-version-file: ".python-version"
63+
cache: 'pip'
64+
cache-dependency-path: scripts/script-requirements.txt
65+
- name: Install Dependencies
66+
if: steps.cache.outputs.cache-hit != 'true'
67+
run: |
68+
python -m pip install --upgrade pip
69+
pip install -r scripts/script-requirements.txt
70+
- name: Generate version docs
71+
if: steps.cache.outputs.cache-hit != 'true'
72+
run: bash scripts/generate-single-version.sh "origin/${{ matrix.version.branch }}" "${{ matrix.version.section }}"
73+
- name: Upload version artifact
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: version-${{ matrix.version.section }}
77+
path: docs/versioned_docs/${{ matrix.version.section }}
78+
retention-days: 1
79+
80+
# Job 3: Assemble all versions, build Hugo site, and deploy to Netlify (draft)
81+
build-and-deploy:
82+
needs: [generate-version]
83+
runs-on: ubuntu-latest
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v4
87+
with:
88+
submodules: recursive
89+
- name: Setup GO
90+
uses: actions/setup-go@v5
91+
with:
92+
go-version: '>=1.20.1'
93+
cache: false
94+
- name: Cache Go modules
95+
uses: actions/cache@v4
96+
with:
97+
path: ~/go/pkg/mod
98+
key: go-mod-${{ hashFiles('docs/go.sum') }}
99+
restore-keys: go-mod-
100+
- name: Setup Node
101+
uses: actions/setup-node@v4
102+
with:
103+
node-version: 20
104+
cache: 'npm'
105+
cache-dependency-path: docs/package-lock.json
106+
- name: Install Hugo
107+
run: npm install -g hugo-extended@0.117.0
108+
- name: Install Dependencies
109+
working-directory: ./docs
110+
run: npm ci
111+
- name: Download version artifacts
112+
uses: actions/download-artifact@v4
113+
with:
114+
pattern: version-*
115+
path: docs/versioned_docs-raw/
116+
- name: Assemble versioned docs
117+
working-directory: ./docs
118+
run: bash ../scripts/assemble-versions.sh
119+
- name: Cache Hugo resources
120+
uses: actions/cache@v4
121+
with:
122+
path: docs/resources/_gen
123+
key: hugo-resources-${{ hashFiles('docs/go.sum', 'docs/config/**') }}
124+
restore-keys: hugo-resources-
125+
- name: Build documentation
126+
working-directory: ./docs
127+
run: hugo --minify --baseURL https://www.gooddata.com/docs/python-sdk
128+
- name: Publish (draft)
129+
uses: netlify/actions/cli@master
130+
with:
131+
args: deploy -d docs/public
132+
env:
133+
NETLIFY_SITE_ID: 93e23db0-d31a-4a12-801a-b9479ffef486 # Not a secret
134+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}

0 commit comments

Comments
 (0)