Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjusted release script to work with public remote (#12953) #12955

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading