Skip to content

Commit c4fd228

Browse files
authored
Use gh to trigger release artifacts CI workflow (#298)
1 parent 19f9abf commit c4fd228

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
@@ -314,6 +315,7 @@ def check_tool(db: ReleaseShelf, tool: str) -> None:
314315
raise ReleaseException(f"{tool} is not available")
315316

316317

318+
check_gh = functools.partial(check_tool, tool="gh")
317319
check_git = functools.partial(check_tool, tool="git")
318320
check_make = functools.partial(check_tool, tool="make")
319321
check_blurb = functools.partial(check_tool, tool="blurb")
@@ -936,21 +938,16 @@ def start_build_release(db: ReleaseShelf) -> None:
936938
# After visually confirming the release manager can start the build process
937939
# with the known good commit SHA.
938940
print()
939-
print(
940-
"Go to https://github.com/python/release-tools/actions/workflows/build-release.yml"
941-
)
942-
print("Select 'Run workflow' and enter the following values:")
943-
print(f"- Git remote to checkout: {origin_remote_github_owner}")
944-
print(f"- Git commit to target for the release: {commit_sha}")
945-
print(f"- CPython release number: {db['release']}")
946-
print()
947-
print("Or using the GitHub CLI run:")
948-
print(
949-
" gh workflow run build-release.yml --repo python/release-tools"
941+
cmd = (
942+
"gh workflow run build-release.yml --repo python/release-tools"
950943
f" -f git_remote={origin_remote_github_owner}"
951944
f" -f git_commit={commit_sha}"
952945
f" -f cpython_release={db['release']}"
953946
)
947+
subprocess.check_call(shlex.split(cmd))
948+
print(
949+
"Go to https://github.com/python/release-tools/actions/workflows/build-release.yml"
950+
)
954951
print()
955952

956953
if not ask_question("Have you started the build-release workflow?"):
@@ -1420,6 +1417,7 @@ def _api_key(api_key: str) -> str:
14201417
magic = release_tag.as_tuple() >= (3, 14)
14211418
no_gpg = release_tag.as_tuple() >= (3, 14) # see PEP 761
14221419
tasks = [
1420+
Task(check_gh, "Checking gh is available"),
14231421
Task(check_git, "Checking Git is available"),
14241422
Task(check_make, "Checking make is available"),
14251423
Task(check_blurb, "Checking blurb is available"),

0 commit comments

Comments
 (0)