Skip to content

Commit c5d7823

Browse files
committed
ci(docs): automate documentation sync and add build validation (cloudnative-pg#10296)
Automatically trigger documentation sync to the docs repository on release tag pushes and when docs/src/ changes are merged to main. Add a CI job that builds the Docusaurus site to catch documentation errors before merging. Closes cloudnative-pg#10295 --------- Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com> (cherry picked from commit a869c82)
1 parent 84fd87a commit c5d7823

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,26 @@ jobs:
345345
exit 1
346346
fi
347347
348+
docs-build:
349+
name: Verify documentation builds
350+
needs:
351+
- duplicate_runs
352+
- change-triage
353+
if: |
354+
needs.duplicate_runs.outputs.should_skip != 'true' &&
355+
needs.change-triage.outputs.docs-changed == 'true'
356+
runs-on: ubuntu-24.04
357+
steps:
358+
- name: Checkout code
359+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
360+
361+
- name: Build documentation
362+
run: |
363+
docker run --rm \
364+
-v ./docs/src:/website/docs \
365+
ghcr.io/cloudnative-pg/docs:latest \
366+
yarn build
367+
348368
crd:
349369
name: Verify CRD is up to date
350370
needs:

.github/workflows/sync-docs.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
name: Sync Docs
22

33
on:
4+
push:
5+
tags:
6+
- v*
7+
branches:
8+
- main
9+
paths:
10+
- 'docs/src/**'
411
workflow_dispatch:
512
inputs:
613
version:
@@ -11,7 +18,36 @@ on:
1118
permissions: {}
1219

1320
jobs:
14-
dispatch:
21+
dispatch-tag:
22+
if: >-
23+
github.repository_owner == 'cloudnative-pg' &&
24+
startsWith(github.ref, 'refs/tags/v')
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Dispatch Docs Repository Workflow
28+
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4
29+
with:
30+
repository: cloudnative-pg/docs
31+
token: ${{ secrets.REPO_GHA_PAT }}
32+
event-type: cnpg-docs-release
33+
client-payload: ${{ format('{{"tag":{0}}}', toJSON(github.ref_name)) }}
34+
35+
dispatch-main:
36+
if: >-
37+
github.repository_owner == 'cloudnative-pg' &&
38+
!startsWith(github.ref, 'refs/tags/')
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Dispatch Docs Repository Workflow
42+
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4
43+
with:
44+
repository: cloudnative-pg/docs
45+
token: ${{ secrets.REPO_GHA_PAT }}
46+
event-type: cnpg-docs-release
47+
client-payload: '{"tag":"main"}'
48+
49+
dispatch-manual:
50+
if: github.event_name == 'workflow_dispatch'
1551
runs-on: ubuntu-latest
1652
steps:
1753
- name: Dispatch Docs Repository Workflow

0 commit comments

Comments
 (0)