From af4f7101f7415cfa57dfd0815a6b81ab01d2bc10 Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Sun, 23 Nov 2025 20:57:41 -0500 Subject: [PATCH] Prepare GitHub release --- scripts/release_github.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 scripts/release_github.py diff --git a/scripts/release_github.py b/scripts/release_github.py new file mode 100644 index 00000000..bfed05bb --- /dev/null +++ b/scripts/release_github.py @@ -0,0 +1,35 @@ +import re +import webbrowser +from pathlib import Path +from urllib.parse import urlencode + + +def main(): + changelog_path = Path(__file__).parents[1] / "docs" / "changelog.md" + changelog = changelog_path.read_text(encoding="utf-8") + + match = re.search( + r"^##\s+Version\s+(?P\S+)[^\n]*\n+(?P.*?)(?=^##\s+Version|\Z)", + changelog, + re.DOTALL | re.MULTILINE, + ) + if not match: + msg = f"Unable to parse changelog at {changelog_path}" + raise RuntimeError(msg) + + version = match.group("version").strip() + notes = match.group("notes").strip() + params = urlencode( + { + "title": f"Version {version}", + "tag": version, + "body": re.sub(r"\{pr\}`(\d+)`", r"#\1", notes), + } + ) + + url = f"https://github.com/jcrist/msgspec/releases/new?{params}" + webbrowser.open_new_tab(url) + + +if __name__ == "__main__": + main()