User: joe Date: 26 Nov 25 22:04 Revision: 6fc242f11ae5bdf6c9b8e88907880cbdd1f3c78d Summary: Actually push during release TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=10327&personal=false Index: create_release.py =================================================================== --- create_release.py (revision d312655a0dd37ac9924b3ce6cdc45685e9e03c02) +++ create_release.py (revision 6fc242f11ae5bdf6c9b8e88907880cbdd1f3c78d) @@ -134,6 +134,17 @@ print(err, file=sys.stderr) sys.exit(1) +def do_push(branch_name: str, dry_run: bool): + print(f"Pushing branch {branch_name}") + rc, out, err = run_git(["push"], dry_run) + if rc != 0: + print(f"Failed to push branch {branch_name}", file=sys.stderr) + if out: + print(out) + if err: + print(err) + sys.exit(1) + def tag_and_push(branch: str, version: str, push: bool, dry_run: bool): tag = f"{branch}-{version}" # check tag does not already exist @@ -165,7 +176,7 @@ print("Fetching origin ...") rc, out, err = run_git(["fetch", "origin"], dry_run) if rc != 0: - print("Warning: 'git fetch origin --prune' returned non-zero.", file=sys.stderr) + print("Warning: 'git fetch origin' returned non-zero.", file=sys.stderr) if out: print(out) if err: @@ -215,12 +226,15 @@ print(f"Merge of {prev} into {br} failed. Aborting.", file=sys.stderr) sys.exit(1) + if push: + do_push(br, dry_run=dry_run) + tag_and_push(br, version, push=push, dry_run=dry_run) prev = br print("\nSwitching back to dev branch...") - run_git(["checkout", "dev"], dry_run) + checkout_branch("dev", dry_run=dry_run) print("\nAll done. Created tags for version", version, "on branches:", ", ".join(branches))