Skip to content

Commit 4ca85a2

Browse files
committed
fix: keep selected docs version in switcher
1 parent 07b7e64 commit 4ca85a2

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

ci_scripts/build_versioned_docs.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ def build_docs(repo_root: Path, output_dir: Path, version_match: str) -> None:
5454
)
5555

5656

57+
def sync_release_build_config(repo_root: Path) -> None:
58+
shutil.copy2(REPO_ROOT / "docs" / "conf.py", repo_root / "docs" / "conf.py")
59+
60+
static_dir = repo_root / "docs" / "_static"
61+
static_dir.mkdir(parents=True, exist_ok=True)
62+
shutil.copy2(REPO_ROOT / "docs" / "_static" / "version_switcher.json", static_dir / "version_switcher.json")
63+
64+
5765
def overwrite_switcher_json(site_dir: Path, entries: list[dict[str, str]]) -> None:
5866
payload = json.dumps(entries, indent=4) + "\n"
5967
for root in [site_dir, site_dir / "latest", *[p for p in site_dir.iterdir() if p.is_dir() and p.name not in {"latest", "_sources", "_static"}]]:
@@ -88,6 +96,7 @@ def main() -> None:
8896
worktree_dir = temp_dir / tag
8997
subprocess.run(["git", "worktree", "add", "--detach", str(worktree_dir), tag], cwd=REPO_ROOT, check=True)
9098
try:
99+
sync_release_build_config(worktree_dir)
91100
release = read_release(worktree_dir)
92101
release_dir = OUTPUT_DIR / release
93102
build_docs(worktree_dir, release_dir, release)

0 commit comments

Comments
 (0)