Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion release.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ def normalized(self) -> str:

@property
def branch(self) -> str:
return "main" if self.is_alpha_release else f"{self.major}.{self.minor}"
if self.is_alpha_release or self.is_feature_freeze_release:
return "main"
return f"{self.major}.{self.minor}"

@property
def is_alpha_release(self) -> bool:
Expand Down
9 changes: 7 additions & 2 deletions run_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -1168,8 +1168,13 @@ def post_release_tagging(db: ReleaseShelf) -> None:
cwd=db["git_repo"],
)

if release_tag.is_feature_freeze_release:
checkout_branch = release_tag.basic_version
else:
checkout_branch = release_tag.branch

subprocess.check_call(
["git", "checkout", release_tag.branch],
["git", "checkout", checkout_branch],
cwd=db["git_repo"],
)

Expand Down Expand Up @@ -1245,7 +1250,7 @@ def branch_new_versions(db: ReleaseShelf) -> None:
subprocess.check_call(["git", "checkout", "main"], cwd=db["git_repo"])

subprocess.check_call(
["git", "checkout", "-b", release_tag.branch],
["git", "checkout", "-b", release_tag.basic_version],
cwd=db["git_repo"],
)

Expand Down
5 changes: 5 additions & 0 deletions tests/test_release_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,31 @@ def test_tag_phase() -> None:
assert alpha.is_feature_freeze_release is False
assert alpha.is_release_candidate is False
assert alpha.is_final is False
assert alpha.branch == "main"

assert beta1.is_alpha_release is False
assert beta1.is_feature_freeze_release is True
assert beta1.is_release_candidate is False
assert beta1.is_final is False
assert beta1.branch == "main"

assert beta4.is_alpha_release is False
assert beta4.is_feature_freeze_release is False
assert beta4.is_release_candidate is False
assert beta4.is_final is False
assert beta4.branch == "3.13"

assert rc.is_alpha_release is False
assert rc.is_feature_freeze_release is False
assert rc.is_release_candidate is True
assert rc.is_final is False
assert rc.branch == "3.13"

assert final.is_alpha_release is False
assert final.is_feature_freeze_release is False
assert final.is_release_candidate is False
assert final.is_final is True
assert final.branch == "3.13"


def test_tag_committed_at_not_found() -> None:
Expand Down
8 changes: 5 additions & 3 deletions tests/test_run_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def test_invalid_extract_github_owner() -> None:
[
# Success cases
("3.15.0rc1", "3.15\n", does_not_raise()),
("3.15.0b1", "3.15\n", does_not_raise()),
("3.15.0b3", "3.15\n", does_not_raise()),
("3.15.0b2", "3.15\n", does_not_raise()),
("3.15.0b1", "main\n", does_not_raise()),
("3.15.0a6", "main\n", does_not_raise()),
("3.14.3", "3.14\n", does_not_raise()),
("3.13.12", "3.13\n", does_not_raise()),
Expand All @@ -71,8 +73,8 @@ def test_invalid_extract_github_owner() -> None:
),
(
"3.15.0b1",
"main\n",
pytest.raises(ReleaseException, match="on main branch, expected 3.15"),
"3.15\n",
pytest.raises(ReleaseException, match="on 3.15 branch, expected main"),
),
(
"3.15.0a6",
Expand Down
Loading