Skip to content

Commit bf3c7ac

Browse files
committed
Use gh to trigger release artifacts CI workflow
1 parent a8981b1 commit bf3c7ac

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

run_release.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import os
1717
import re
1818
import shelve
19+
import shlex
1920
import shutil
2021
import subprocess
2122
import sys
@@ -312,6 +313,7 @@ def check_tool(db: ReleaseShelf, tool: str) -> None:
312313
raise ReleaseException(f"{tool} is not available")
313314

314315

316+
check_gh = functools.partial(check_tool, tool="gh")
315317
check_git = functools.partial(check_tool, tool="git")
316318
check_make = functools.partial(check_tool, tool="make")
317319
check_blurb = functools.partial(check_tool, tool="blurb")
@@ -927,21 +929,16 @@ def start_build_release(db: ReleaseShelf) -> None:
927929
# After visually confirming the release manager can start the build process
928930
# with the known good commit SHA.
929931
print()
930-
print(
931-
"Go to https://github.com/python/release-tools/actions/workflows/build-release.yml"
932-
)
933-
print("Select 'Run workflow' and enter the following values:")
934-
print(f"- Git remote to checkout: {origin_remote_github_owner}")
935-
print(f"- Git commit to target for the release: {commit_sha}")
936-
print(f"- CPython release number: {db['release']}")
937-
print()
938-
print("Or using the GitHub CLI run:")
939-
print(
940-
" gh workflow run build-release.yml --repo python/release-tools"
932+
cmd = (
933+
"gh workflow run build-release.yml --repo python/release-tools"
941934
f" -f git_remote={origin_remote_github_owner}"
942935
f" -f git_commit={commit_sha}"
943936
f" -f cpython_release={db['release']}"
944937
)
938+
subprocess.check_call(shlex.split(cmd))
939+
print(
940+
"Go to https://github.com/python/release-tools/actions/workflows/build-release.yml"
941+
)
945942
print()
946943

947944
if not ask_question("Have you started the build-release workflow?"):
@@ -1390,6 +1387,7 @@ def _api_key(api_key: str) -> str:
13901387
release_tag = release_mod.Tag(args.release)
13911388
no_gpg = release_tag.as_tuple() >= (3, 14) # see PEP 761
13921389
tasks = [
1390+
Task(check_gh, "Checking gh is available"),
13931391
Task(check_git, "Checking Git is available"),
13941392
Task(check_make, "Checking make is available"),
13951393
Task(check_blurb, "Checking blurb is available"),

0 commit comments

Comments
 (0)