Skip to content

feat: detect version_stable and version_start dynamically in CI#15176

Merged
skjnldsv merged 3 commits into
masterfrom
feat/dynamic-version-detection
Jul 2, 2026
Merged

feat: detect version_stable and version_start dynamically in CI#15176
skjnldsv merged 3 commits into
masterfrom
feat/dynamic-version-detection

Conversation

@skjnldsv

@skjnldsv skjnldsv commented Jun 17, 2026

Copy link
Copy Markdown
Member

Follows up on

What and why

Previously version_stable, version_start, and display_version in conf.py were either hardcoded or detected via regex against GITHUB_REF/GITHUB_BASE_REF. Every time a new NC stable ships, all active branches had to be touched manually to keep the version picker accurate.

This PR makes all three values fully dynamic in CI by moving all branch detection logic out of conf.py into sphinxbuild.yml. The detect step runs on every HTML build (all branches, all PRs) and exports three env vars:

  • DOCS_VERSION_STABLE — highest released stableNN (GitHub API check via detect-versions.php)
  • DOCS_VERSION_START — lowest stableNN within the 1-year support window (same)
  • DOCS_DISPLAY_VERSION — branch number for stableNN builds, highest_stable + 1 for master

conf.py reads them via os.environ.get() with the current values as fallbacks for local builds. No more import re, no regex, no GITHUB_BASE_REF sniffing in Python.

Result: branching off stable35 from master requires zero conf.py changes. Old branches auto-show the current picker state whenever rebuilt. The master-only validation step is removed — detection always runs and the PHP script already exits with an error if no stable branch is found.

Trade-off: PHP + GitHub API call added to every HTML build (~10-20s overhead).

Screenshots

Before After
2026-06-17_11-23_1 2026-06-17_11-21_1
2026-06-17_11-23 2026-06-17_11-21

Also in this PR

  • Version picker entry labels: 35 (upcoming) / 34 (latest) / 33 (stable) / 32 (stable) / N (unsupported)
  • Picker layout: versions use a 2-column grid, languages keep their 3-column layout (nc-versions-list / nc-languages-list classes added to dl elements)
  • Emoji in versions dt acts as a heading bullet; dd entries indented to align with the text after it
  • Inline style="width: 32%" removed from all picker dd elements (layout now owned by CSS grid)

Changes

  • conf.py: three os.environ.get() reads with hardcoded fallbacks
  • sphinxbuild.yml: version detection runs unconditionally on all branches; exports DOCS_VERSION_STABLE, DOCS_VERSION_START, DOCS_DISPLAY_VERSION to $GITHUB_ENV; old master-only validation step removed
  • _shared_assets/static/custom.css: grid layout rules for both picker sections
  • */templates/versions.html: nc-versions-list / nc-languages-list classes on dl elements

✅ Checklist

  • I have built the documentation locally and reviewed the output
  • Screenshots are included for visual changes
  • I have not moved or renamed pages (or added a redirect if I did)
  • I have run codespell or similar and addressed any spelling issues

@github-actions github-actions Bot added the github_actions Pull requests that update GitHub Actions code label Jun 17, 2026
@skjnldsv skjnldsv marked this pull request as ready for review June 17, 2026 08:00
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

🔍 Open preview →

No RST documentation pages changed in this PR.

Last updated: Thu, 02 Jul 2026 09:27:28 GMT

All version constants (version_stable, version_start, display_version)
are now injected by CI via detect-versions.php rather than hardcoded in
conf.py. Branching off stable35 requires zero conf.py changes — the new
branch auto-detects its version from GITHUB_REF/GITHUB_BASE_REF.

sphinxbuild.yml runs PHP detection on every HTML build and exports
DOCS_VERSION_STABLE, DOCS_VERSION_START and DOCS_DISPLAY_VERSION to
the environment. conf.py reads them with hardcoded fallbacks for local
builds. No more regex or GITHUB_BASE_REF sniffing in Python.

Version picker labels are also updated: 35 (upcoming) / 34 (latest) /
33 (stable) / 32 (stable) / N (unsupported). The picker uses a 2-column
grid for both the versions and languages sections, with the section emoji
injected via CSS ::before so the label text and entries align cleanly.

Follows up on #13404 and #15140.

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv skjnldsv force-pushed the feat/dynamic-version-detection branch from fbc5b3d to 6c850a2 Compare July 2, 2026 09:15
skjnldsv added 2 commits July 2, 2026 11:17
The env vars (DOCS_VERSION_STABLE, DOCS_VERSION_START) are always current
in CI, but the hardcoded fallbacks in conf.py are used for local builds.
This step catches them drifting after a new NC release so the fallbacks
stay useful without silently going stale.

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
The comment line also contains DOCS_VERSION_STABLE, causing grep -m1
to return no number and the comparison to always fail.

Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv skjnldsv merged commit 46c7963 into master Jul 2, 2026
20 of 21 checks passed
@skjnldsv skjnldsv deleted the feat/dynamic-version-detection branch July 2, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant