Skip to content

Commit ad4f357

Browse files
committed
feat: Add tag signature verification stage in release.
1 parent 5ff8a17 commit ad4f357

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tools/create_release.py

+23
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import create_tarballs
1212
import sign_release_assets
13+
import sign_tag
1314
import validate_pr
1415
import verify_release_assets
1516
from lib import changelog
@@ -607,6 +608,27 @@ def stage_tag(config: Config, version: str) -> None:
607608
s.ok(f"Pushed tag {version} to {config.upstream}")
608609

609610

611+
def stage_sign_tag(config: Config, version: str) -> None:
612+
with stage.Stage("Sign tag", "Signing/verifying the release tag") as s:
613+
git.fetch(config.upstream)
614+
if git.tag_has_signature(version):
615+
if not git.verify_tag(version):
616+
raise s.fail(f"Tag {version} signature cannot be verified")
617+
s.ok("Tag already signed")
618+
return
619+
if config.github_actions:
620+
s.ok("Asking user to sign the tag")
621+
raise assign_to_user(s, config.issue, "sign the tag")
622+
sign_tag.main(
623+
sign_tag.Config(
624+
tag=version,
625+
upstream=config.upstream,
626+
verify_only=False,
627+
local_only=config.dryrun,
628+
))
629+
s.ok("Tag signed")
630+
631+
610632
def stage_build_binaries(config: Config, version: str) -> None:
611633
"""Wait for GitHub Actions to build the binaries.
612634
@@ -774,6 +796,7 @@ def run_stages(config: Config) -> None:
774796
stage_await_merged(config, version)
775797
stage_await_master_build(config, version)
776798
stage_tag(config, version)
799+
stage_sign_tag(config, version)
777800
stage_build_binaries(config, version)
778801
stage_create_tarballs(version)
779802
stage_sign_release_assets(config, version)

0 commit comments

Comments
 (0)