feat: detect version_stable and version_start dynamically in CI#15176
Merged
Conversation
Contributor
📖 Documentation PreviewNo RST documentation pages changed in this PR. Last updated: Thu, 02 Jul 2026 09:27:28 GMT |
cff07b7 to
622f169
Compare
622f169 to
fbc5b3d
Compare
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>
fbc5b3d to
6c850a2
Compare
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows up on
What and why
Previously
version_stable,version_start, anddisplay_versioninconf.pywere either hardcoded or detected via regex againstGITHUB_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.pyintosphinxbuild.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 viadetect-versions.php)DOCS_VERSION_START— lowest stableNN within the 1-year support window (same)DOCS_DISPLAY_VERSION— branch number for stableNN builds,highest_stable + 1for masterconf.pyreads them viaos.environ.get()with the current values as fallbacks for local builds. No moreimport re, no regex, noGITHUB_BASE_REFsniffing in Python.Result: branching off
stable35from 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
Also in this PR
35 (upcoming)/34 (latest)/33 (stable)/32 (stable)/N (unsupported)nc-versions-list/nc-languages-listclasses added todlelements)dtacts as a heading bullet;ddentries indented to align with the text after itstyle="width: 32%"removed from all pickerddelements (layout now owned by CSS grid)Changes
conf.py: threeos.environ.get()reads with hardcoded fallbackssphinxbuild.yml: version detection runs unconditionally on all branches; exportsDOCS_VERSION_STABLE,DOCS_VERSION_START,DOCS_DISPLAY_VERSIONto$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-listclasses ondlelements✅ Checklist
codespellor similar and addressed any spelling issues