Skip to content

Commit 31cc0c7

Browse files
committed
automate installation.adoc update
1 parent 8009acb commit 31cc0c7

File tree

1 file changed

+35
-9
lines changed

1 file changed

+35
-9
lines changed

scripts/release_helper/post_release_main.py

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def update_changelog(new_version: PythonLibraryVersion) -> None:
100100
print(f"✅ Updated {changelog_file.relative_to(REPO_ROOT)} for version {new_version}")
101101

102102

103-
def update_publish_yml(released_version: PythonLibraryVersion) -> None:
103+
def update_publish_yml(released_version: PythonLibraryVersion, next_version: PythonLibraryVersion) -> None:
104104
publish_file = REPO_ROOT / "doc" / "publish.yml"
105105
content = publish_file.read_text()
106106

@@ -109,17 +109,20 @@ def update_publish_yml(released_version: PythonLibraryVersion) -> None:
109109

110110
# Update branches list
111111
updated = re.sub(r"(branches:\s*\[)([^\]]*)", lambda m: f"{m.group(1)}{m.group(2)}, '{new_branch}'", content)
112-
updated = re.sub(r"api-version: [^']*", f"version: {released_version.major_minor()}", updated)
112+
# Update api-version to next version
113+
updated = re.sub(r"api-version:\s*\d+\.\d+", f"api-version: {next_version.major_minor()}", updated)
113114

114115
publish_file.write_text(updated)
115-
print(f"✓ Updated {publish_file.relative_to(REPO_ROOT)} - added branch '{new_branch}'")
116+
print(
117+
f"✓ Updated {publish_file.relative_to(REPO_ROOT)} - added branch '{new_branch}' and set api-version to {next_version.major_minor()}"
118+
)
116119

117120

118121
def update_preview_yml(released_version: PythonLibraryVersion) -> None:
119122
preview_file = REPO_ROOT / "doc" / "preview.yml"
120123
content = preview_file.read_text()
121124

122-
updated = re.sub(r"api-version: [^']*", f"version: {released_version.major_minor()}", content)
125+
updated = re.sub(r"api-version: (\d+)\.(\d+)", f"api-version: {released_version.major_minor()}", content)
123126

124127
preview_file.write_text(updated)
125128
print(f"✓ Updated {preview_file.relative_to(REPO_ROOT)} to version {released_version}")
@@ -149,6 +152,28 @@ def update_package_json(new_version: PythonLibraryVersion) -> None:
149152
print(f"✓ Updated {package_file.relative_to(REPO_ROOT)} to version {preview_version}")
150153

151154

155+
def update_installation_adoc(next_version: PythonLibraryVersion) -> None:
156+
new_compat_table_entry = f"""
157+
.1+<.^| {next_version.major_minor()}
158+
.1+<.^| >= 2.6, < 2.24
159+
.1+<.^| >= 3.10, < 3.13
160+
.1+<.^| >= 4.4.12, < 7.0.0
161+
""".strip()
162+
163+
installation_file = REPO_ROOT / "doc" / "modules" / "ROOT" / "pages" / "installation.adoc"
164+
content = installation_file.read_text()
165+
166+
version_table_regex = r"(?s)(\| Python Client \| GDS version[^\n]*)(.*)(\|===)"
167+
match = re.search(version_table_regex, content, re.MULTILINE)
168+
if not match:
169+
raise ValueError("Could not find installation table in installation.adoc")
170+
version_table = match.group(2)
171+
updated_version_table = f"\n{new_compat_table_entry}\n" + version_table
172+
updated = content.replace(version_table, updated_version_table)
173+
installation_file.write_text(updated)
174+
print(f"✓ Updated {installation_file.relative_to(REPO_ROOT)} with new version {next_version}")
175+
176+
152177
def main() -> None:
153178
# Get current version
154179
current_version = read_library_version()
@@ -165,13 +190,14 @@ def main() -> None:
165190

166191
if not current_version.is_alpha():
167192
update_changelog(next_version)
168-
update_antora_yml(current_version)
169-
# update_publish_yml(current_version)
170-
# update_preview_yml(current_version)
193+
171194
update_package_json(next_version)
172195

173-
# TODO installation doc
174-
# update_installation_adoc(current_version, next_version)
196+
update_antora_yml(current_version)
197+
update_publish_yml(current_version, next_version)
198+
update_preview_yml(current_version)
199+
200+
update_installation_adoc(next_version)
175201

176202
print("\n✅ Post-release tasks completed!")
177203
print("\nNext steps:")

0 commit comments

Comments
 (0)