Skip to content

Commit e7f7aef

Browse files
authored
chore: improve release script (#4792)
1 parent 6cc4abe commit e7f7aef

File tree

1 file changed

+28
-11
lines changed

1 file changed

+28
-11
lines changed

scripts/release.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,24 +109,29 @@ def main() -> None:
109109
colored_print("Invalid input. Please enter a number.", Colors.YELLOW)
110110

111111
pixi = get_pixi()
112+
113+
step = 1
112114
try:
113115
if start_step <= 1:
114-
colored_print("Making a release of pixi", Colors.YELLOW)
116+
colored_print(f"{step}. Making a release of pixi", Colors.YELLOW)
115117
status.append("Started release process")
118+
step += 1
116119

117120
if start_step <= 2:
118121
colored_input(
119-
"Make sure main is up-to-date and CI passes. Press Enter to continue...",
122+
f"{step}. Make sure main is up-to-date and CI passes. Press Enter to continue...",
120123
Colors.MAGENTA,
121124
)
122125
status.append("Checked main branch and CI status")
126+
step += 1
123127

124128
release_version = get_release_version()
125129
os.environ["RELEASE_VERSION"] = release_version
126130
status.append(f"Release version set to {release_version}")
131+
step += 1
127132

128133
if start_step <= 4:
129-
colored_print("\nCreating a new branch for the release...", Colors.YELLOW)
134+
colored_print(f"\n{step}. Creating a new branch for the release...", Colors.YELLOW)
130135
run_command(["git", "checkout", "main"])
131136
run_command(["git", "pull", "upstream", "main"])
132137
branch = f"bump/prepare-v{release_version}"
@@ -136,21 +141,26 @@ def main() -> None:
136141
run_command(["git", "branch", "--delete", branch])
137142
run_command(["git", "switch", "--create", branch])
138143
status.append(f"Created and switched to branch {branch}")
144+
step += 1
139145

140146
if start_step <= 5:
141-
colored_print("\nBumping all versions...", Colors.YELLOW)
147+
colored_print(f"\n{step}. Bumping all versions...", Colors.YELLOW)
142148
run_command([pixi, "run", "bump"])
143149
status.append("Bumped all versions")
150+
step += 1
144151

145152
if start_step <= 6:
146-
colored_print("\nUpdate Cargo pixi lockfile...", Colors.YELLOW)
153+
colored_print(f"\n{step}. Update Cargo pixi lockfile...", Colors.YELLOW)
147154
run_command([pixi, "run", "cargo update pixi"])
148155
status.append("Updated all lockfile")
156+
step += 1
149157

150158
if start_step <= 7:
151159
while True:
152160
response = (
153-
colored_input("Should we bump the changelog? (yes/no): ", Colors.MAGENTA)
161+
colored_input(
162+
f"{step}. Should we bump the changelog? (yes/no): ", Colors.MAGENTA
163+
)
154164
.strip()
155165
.lower()
156166
)
@@ -165,29 +175,36 @@ def main() -> None:
165175
Colors.MAGENTA,
166176
)
167177
status.append("Updated the changelog")
178+
step += 1
168179

169180
if start_step <= 8:
170-
colored_print("\nLinting the changes...", Colors.YELLOW)
181+
colored_print(f"\n{step}. Linting the changes...", Colors.YELLOW)
171182
run_command([pixi, "run", "lint"])
183+
step += 1
172184

173185
if start_step <= 9:
174-
colored_print("\nCommitting the changes...", Colors.YELLOW)
186+
colored_print(f"\n{step}. Committing the changes...", Colors.YELLOW)
175187
run_command(["git", "commit", "-am", f"chore: version to {release_version}"])
176188
status.append("Committed the changes")
189+
step += 1
177190

178191
if start_step <= 10:
179-
colored_print("\nPushing the changes...", Colors.YELLOW)
180-
run_command(["git", "push", "origin"])
192+
colored_print(f"\n{step}. Pushing the changes...", Colors.YELLOW)
193+
run_command(
194+
["git", "push", "--set-upstream", "origin", f"bump/prepare-v{release_version}"]
195+
)
181196
status.append("Pushed the changes")
197+
step += 1
182198

183199
if start_step <= 11:
184-
colored_print("\nRelease prep PR", Colors.YELLOW)
200+
colored_print(f"\n{step}. Release prep PR", Colors.YELLOW)
185201
colored_input(
186202
"Create a PR to check off the change with the peers. Press Enter to continue...",
187203
Colors.MAGENTA,
188204
)
189205
colored_input("Merge that PR. Press Enter to continue...", Colors.MAGENTA)
190206
status.append("Created and merged the release prep PR")
207+
step += 1
191208

192209
colored_print(
193210
f"\nStart a release build for 'v{release_version}' by starting the workflow manually in https://github.com/prefix-dev/pixi/actions/workflows/release.yml",

0 commit comments

Comments
 (0)