(base_branch: str, is_major: bool, prerelease: str)
| 53 | |
| 54 | |
| 55 | def prepare_release_pr(base_branch: str, is_major: bool, prerelease: str) -> None: |
| 56 | print() |
| 57 | print(f"Processing release for branch {Fore.CYAN}{base_branch}") |
| 58 | |
| 59 | check_call(["git", "checkout", f"origin/{base_branch}"]) |
| 60 | |
| 61 | changelog = Path("changelog") |
| 62 | |
| 63 | features = list(changelog.glob("*.feature.rst")) |
| 64 | breaking = list(changelog.glob("*.breaking.rst")) |
| 65 | is_feature_release = bool(features or breaking) |
| 66 | |
| 67 | try: |
| 68 | version = find_next_version( |
| 69 | base_branch, is_major, is_feature_release, prerelease |
| 70 | ) |
| 71 | except InvalidFeatureRelease as e: |
| 72 | print(f"{Fore.RED}{e}") |
| 73 | raise SystemExit(1) from None |
| 74 | |
| 75 | print(f"Version: {Fore.CYAN}{version}") |
| 76 | |
| 77 | release_branch = f"release-{version}" |
| 78 | |
| 79 | run( |
| 80 | ["git", "config", "user.name", "pytest bot"], |
| 81 | check=True, |
| 82 | ) |
| 83 | run( |
| 84 | ["git", "config", "user.email", "pytestbot@gmail.com"], |
| 85 | check=True, |
| 86 | ) |
| 87 | |
| 88 | run( |
| 89 | ["git", "checkout", "-b", release_branch, f"origin/{base_branch}"], |
| 90 | check=True, |
| 91 | ) |
| 92 | |
| 93 | print(f"Branch {Fore.CYAN}{release_branch}{Fore.RESET} created.") |
| 94 | |
| 95 | if is_major: |
| 96 | template_name = "release.major.rst" |
| 97 | elif prerelease: |
| 98 | template_name = "release.pre.rst" |
| 99 | elif is_feature_release: |
| 100 | template_name = "release.minor.rst" |
| 101 | else: |
| 102 | template_name = "release.patch.rst" |
| 103 | |
| 104 | # important to use tox here because we have changed branches, so dependencies |
| 105 | # might have changed as well |
| 106 | cmdline = [ |
| 107 | "tox", |
| 108 | "-e", |
| 109 | "release", |
| 110 | "--", |
| 111 | version, |
| 112 | template_name, |
no test coverage detected
searching dependent graphs…