@@ -711,11 +711,9 @@ def stage_tag(self, version: str) -> None:
711711 """Tag the release and push it to upstream."""
712712 with stage.Stage("Tag release", "Tagging the release") as s:
713713 release_notes = changelog.get_release_notes(version).notes + "\n"
714- if self.git.release_tag_exists(version):
714+ tag_exists = self.git.release_tag_exists(version)
715+ if tag_exists:
715716 s.progress(f"Tag {version} already exists")
716- if self.config.github_actions:
717- s.ok("No tag push required")
718- return
719717 else:
720718 self.git.tag(
721719 version, release_notes, sign=not self.config.github_actions
@@ -724,19 +722,38 @@ def stage_tag(self, version: str) -> None:
724722
725723 if self.config.dryrun:
726724 s.ok("Dry run; not pushing tag")
727- elif self.config.github_actions and not self.config.dryrun:
728- s.progress(f"Pushing tag {version} with GitHub API")
729- sha = self.github.tag(
730- self.git.remote_slug(self.config.upstream),
731- self.git.branch_sha(version),
732- version,
733- release_notes,
725+ return
726+
727+ if self.config.github_actions:
728+ if not tag_exists:
729+ s.progress(f"Pushing tag {version} with GitHub API")
730+ sha = self.github.tag(
731+ self.git.remote_slug(self.config.upstream),
732+ self.git.branch_sha(version),
733+ version,
734+ release_notes,
735+ )
736+ else:
737+ sha = self.git.branch_sha(version)
738+
739+ self.github.create_release(
740+ version, release_notes, prerelease=not self.config.production
734741 )
742+ self.github.clear_cache()
735743 self.git.fetch(self.config.upstream)
736744 s.ok(f"Tagged {version} @ {sha}")
737745 else:
738- self.git.push(self.config.upstream, version, force=self.config.force)
739- s.ok(f"Pushed tag {version} to {self.config.upstream}")
746+ if not tag_exists:
747+ self.git.push(
748+ self.config.upstream, version, force=self.config.force
749+ )
750+ s.progress(f"Pushed tag {version} to {self.config.upstream}")
751+
752+ self.github.create_release(
753+ version, release_notes, prerelease=not self.config.production
754+ )
755+ self.github.clear_cache()
756+ s.ok()
740757
741758 def stage_sign_tag(self, version: str) -> None:
742759 with stage.Stage("Sign tag", "Signing/verifying the release tag") as s:
@@ -927,10 +944,15 @@ def run_stages(self) -> None:
927944 self.stage_push()
928945 self.stage_pull_request(version)
929946 self.update_dashboard(version)
930- self.stage_await_checks(version)
931- if self.config.verify:
947+ if not self.config.dryrun:
948+ self.stage_await_checks(version)
949+ if self.config.verify:
950+ return
951+ self.stage_ready_for_review(version)
952+
953+ if self.config.dryrun:
954+ print("Dry run: stopping after preparation")
932955 return
933- self.stage_ready_for_review(version)
934956 else:
935957 print(
936958 f"Release branch {BRANCH_PREFIX}/{version} already merged.", flush=True
0 commit comments