Skip to content

Commit e184c97

Browse files
committed
Trigger docs build from release workflow
Add workflow_dispatch input to docs workflow for specifying a git ref. Release workflow now triggers docs build after creating GitHub release, passing the version tag to build versioned documentation.
1 parent c16dc9e commit e184c97

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

.github/workflows/docs.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ on:
1010
push:
1111
tags: ['v*']
1212
workflow_dispatch:
13+
inputs:
14+
ref:
15+
description: 'Git ref to build docs from (tag or branch)'
16+
required: false
17+
type: string
1318

1419
permissions:
1520
contents: read
@@ -31,17 +36,20 @@ jobs:
3136
steps:
3237
- uses: actions/checkout@v4
3338
with:
34-
# For workflow_run, checkout the commit that triggered CI
35-
ref: ${{ github.event.workflow_run.head_sha || github.ref }}
39+
# Priority: workflow_dispatch input > workflow_run commit > current ref
40+
ref: ${{ inputs.ref || github.event.workflow_run.head_sha || github.ref }}
3641

3742
- name: Install uv
3843
uses: astral-sh/setup-uv@v4
3944

4045
- name: Determine version
4146
id: version
4247
run: |
43-
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
44-
VERSION="${GITHUB_REF#refs/tags/v}"
48+
# Check input ref first (from workflow_dispatch), then GITHUB_REF
49+
REF="${{ inputs.ref || github.ref }}"
50+
if [[ "$REF" == refs/tags/v* ]] || [[ "$REF" == v* ]]; then
51+
VERSION="${REF#refs/tags/}"
52+
VERSION="${VERSION#v}"
4553
else
4654
VERSION="latest"
4755
fi
@@ -71,8 +79,10 @@ jobs:
7179
- name: Determine version
7280
id: version
7381
run: |
74-
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
75-
VERSION="${GITHUB_REF#refs/tags/v}"
82+
REF="${{ inputs.ref || github.ref }}"
83+
if [[ "$REF" == refs/tags/v* ]] || [[ "$REF" == v* ]]; then
84+
VERSION="${REF#refs/tags/}"
85+
VERSION="${VERSION#v}"
7686
else
7787
VERSION="latest"
7888
fi

.github/workflows/release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ on:
3434

3535
permissions:
3636
contents: write
37+
actions: write # Required to trigger docs workflow
3738

3839
jobs:
3940
prepare-version:
@@ -202,3 +203,10 @@ jobs:
202203
fi
203204
env:
204205
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
206+
207+
- name: Trigger docs build
208+
run: |
209+
VERSION="${{ needs.prepare-version.outputs.version }}"
210+
gh workflow run docs.yml -f ref="v$VERSION"
211+
env:
212+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)