Skip to content

Commit c1dadbb

Browse files
committed
Numeric semver sort and propagate gh failures in release-prepare.
1 parent 8ba61eb commit c1dadbb

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

scripts/release-prepare.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,12 @@ make_cli_entry() {
212212
shift 3
213213
local -a rust_versions=("$@")
214214

215+
# Sort numerically so 1.100.0 lands AFTER 1.99.0; default jq `sort` on
216+
# strings would put "1.100.0" before "1.99.0" lexicographically.
215217
local rust_array
216-
rust_array="$(printf '%s\n' "${rust_versions[@]}" | jq -R . | jq -s 'sort')"
218+
rust_array="$(printf '%s\n' "${rust_versions[@]}" \
219+
| jq -R . \
220+
| jq -s 'sort_by(split(".") | map(tonumber))')"
217221

218222
jq -n \
219223
--arg default_rust "$default_rust" \
@@ -238,8 +242,11 @@ pick_release_tag() {
238242
local cli_pat
239243
cli_pat="$(printf '%s' "$cli" | sed 's/\./\\./g')"
240244

245+
# Let gh failures (auth, network, API outage) propagate — silently
246+
# treating them as "no releases" would suggest tag v<cli> even when one
247+
# really exists, leading to a confusing create-release link in the PR.
241248
local existing_tags
242-
existing_tags="$(gh release list --limit 200 --json tagName --jq '.[].tagName' 2>/dev/null || true)"
249+
existing_tags="$(gh release list --limit 200 --json tagName --jq '.[].tagName')"
243250

244251
if ! grep -qE "^v${cli_pat}\$" <<<"$existing_tags"; then
245252
printf 'v%s\n' "$cli"

0 commit comments

Comments
 (0)