Skip to content

Commit 9e0d482

Browse files
authored
Merge pull request #60 from skjnldsv/copilot/update-release-version-string
fix: use actual release version in PDF output instead of "latest"
2 parents d43b8de + 1f52c86 commit 9e0d482

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/sphinxbuild.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,21 @@ jobs:
8585
- name: Build html documentation
8686
run: cd ${{ matrix.manual.directory }} && make ${{ matrix.manual.make_target }}
8787

88+
- name: Compute PDF release version
89+
if: ${{ matrix.manual.build_pdf_path }}
90+
id: pdf_version
91+
run: |
92+
branch="${GITHUB_REF#refs/heads/}"
93+
if [[ "$branch" == stable* ]]; then
94+
echo "release=${branch#stable}" >> $GITHUB_OUTPUT
95+
else
96+
echo "release=latest" >> $GITHUB_OUTPUT
97+
fi
98+
8899
- name: Build pdf documentation
89100
if: ${{ matrix.manual.build_pdf_path }}
101+
env:
102+
DOCS_RELEASE: ${{ steps.pdf_version.outputs.release }}
90103
run: |
91104
set -e
92105
cd ${{ matrix.manual.directory }}

conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
# The short X.Y version.
2929
version = 'latest'
3030
# The full version, including alpha/beta/rc tags.
31-
release = version
31+
# Can be overridden via DOCS_RELEASE env var (used for PDF builds to show the actual version number)
32+
release = os.environ.get('DOCS_RELEASE', version)
3233

3334
# RTD theme options
3435
html_theme_options = {

0 commit comments

Comments
 (0)