11#!/usr/bin/env python3
2- """Bump xlm-core version , push to main, and create a GitHub release.
2+ """Bump xlm-core and xlm-models versions , push to main, and create a GitHub release.
33
44Used locally and from .github/workflows/release.yml. The release tag is always
55``v`` + the version read from ``src/xlm/version.py`` after the bump, matching
6- publish.yml / docs-release.yml.
6+ publish.yml / docs-release.yml. Both ``src/xlm/version.py`` and
7+ ``xlm-models/version.py`` are updated to the same version.
78
89Examples:
910 python .github/release.py 0.1.4
2324
2425REPO_ROOT = Path (__file__ ).resolve ().parents [1 ]
2526VERSION_PY = REPO_ROOT / "src" / "xlm" / "version.py"
27+ MODELS_VERSION_PY = REPO_ROOT / "xlm-models" / "version.py"
28+ VERSION_PY_PATHS = (VERSION_PY , MODELS_VERSION_PY )
2629TAG_PREFIX = "v"
2730
2831_VERSION_ENV_KEYS = (
@@ -173,7 +176,10 @@ def require_clean_tree(dry_run: bool) -> None:
173176
174177def main (argv : list [str ] | None = None ) -> int :
175178 parser = argparse .ArgumentParser (
176- description = "Bump version.py, push to main, and publish a GitHub release." ,
179+ description = (
180+ "Bump version.py files for xlm-core and xlm-models, push to main, "
181+ "and publish a GitHub release."
182+ ),
177183 )
178184 parser .add_argument (
179185 "version" ,
@@ -246,16 +252,20 @@ def main(argv: list[str] | None = None) -> int:
246252
247253 if not args .publish_only :
248254 require_clean_tree (args .dry_run )
249- write_version (target )
250- written = read_version ()
251- if written != target .version :
252- raise RuntimeError (
253- f"version.py mismatch after write: expected { target .version } , got { written } "
254- )
255- print (f"Updated { VERSION_PY .relative_to (REPO_ROOT )} " )
255+ for path in VERSION_PY_PATHS :
256+ write_version (target , path = path )
257+ written = read_version (path )
258+ if written != target .version :
259+ raise RuntimeError (
260+ f"{ path } mismatch after write: expected { target .version } , got { written } "
261+ )
262+ print (f"Updated { path .relative_to (REPO_ROOT )} " )
256263
257264 commit_msg = f"Release version { target .version } "
258- run (["git" , "add" , str (VERSION_PY .relative_to (REPO_ROOT ))], dry_run = args .dry_run )
265+ run (
266+ ["git" , "add" , * [str (p .relative_to (REPO_ROOT )) for p in VERSION_PY_PATHS ]],
267+ dry_run = args .dry_run ,
268+ )
259269 run (["git" , "commit" , "-m" , commit_msg ], dry_run = args .dry_run )
260270
261271 if not args .skip_push :
@@ -278,7 +288,10 @@ def main(argv: list[str] | None = None) -> int:
278288 if args .dry_run :
279289 print ("Dry run complete; no changes were pushed and no release was created." )
280290 else :
281- print (f"Done. Published { target .tag } — PyPI/docs workflows run on release publish." )
291+ print (
292+ f"Done. Published { target .tag } — PyPI (xlm-core + xlm-models) and docs "
293+ "workflows run on release publish."
294+ )
282295 return 0
283296
284297
0 commit comments