Skip to content

Commit

Permalink
adjusted release script to work with public remote (#12953) (#12955)
Browse files Browse the repository at this point in the history
  • Loading branch information
twerkmeister committed Nov 17, 2023
1 parent 3ea9722 commit 7d8e816
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@

RELEASE_BRANCH_PATTERN = re.compile(r"^\d+\.\d+\.x$")

PUBLIC_REMOTE = "public"
DEFAULT_REMOTE = "origin"
FIRST_CALM_VERSION = "3.7.0"


def create_argument_parser() -> argparse.ArgumentParser:
"""Parse all the command line arguments for the release script."""
Expand Down Expand Up @@ -244,9 +248,9 @@ def create_commit(version: Version) -> None:
check_call(["git", "commit", "-m", f"prepared release of version {version}"])


def push_changes() -> None:
"""Pushes the current branch to origin."""
check_call(["git", "push", "origin", "HEAD"])
def push_changes(remote: str = DEFAULT_REMOTE) -> None:
"""Pushes the current branch to the specified remote."""
check_call(["git", "push", remote, "HEAD"])


def ensure_clean_git() -> None:
Expand Down Expand Up @@ -334,18 +338,19 @@ def main(args: argparse.Namespace) -> None:
# never update changelog on a prerelease version
generate_changelog(version)

remote = PUBLIC_REMOTE if str(version) < FIRST_CALM_VERSION else DEFAULT_REMOTE
# alpha workflow on feature branch when a version bump is required
if version.is_alpha and not git_current_branch_is_main_or_release():
create_commit(version)
push_changes()
push_changes(remote)

print_done_message_same_branch(version)
else:
base = git_current_branch()
branch = create_release_branch(version)

create_commit(version)
push_changes()
push_changes(remote)

print_done_message(branch, base, version)

Expand Down

0 comments on commit 7d8e816

Please sign in to comment.