Files
kiri/scripts/ci/test-version.sh
Precious Okwu 52c785ca90 CI & updates: bump patch version for -rc test builds (#1261)
Non-tag CI/test builds previously stamped <released>-dev.<run> (for example 0.3.0-dev.<run>), reusing the already-shipped version in WiX MSI ProductVersion and macOS Info.plist and sorting below the release in Debian/RPM packaging.

Update scripts/ci/test-version.sh to bump the patch component of the published release from latest.json by 1 and append -rc.<run> (for example 0.3.0 -> 0.3.1-rc.<run>, falling back to 0.0.1-rc.<run> when unreachable). Extract shared version parsing, comparison, and test-build classification into crates/kiri/src/version.rs so the macOS/Linux window (crates/kiri/src/ui/mod.rs, crates/kiri/src/ui/linux.rs) and Windows app (crates/kiri-win/src/update.rs) recognise both -rc and -dev test builds cleanly, while sorting X.Y.Z-rc.N after X.Y.(Z-1) and before X.Y.Z (preserving legacy -dev sorting).
2026-12-06 10:27:23 +01:00

18 lines
929 B
Bash
Executable File

#!/bin/sh
# A build that isn't a release bumps the patch version of the currently
# published release from the update feed (0.3.0 -> 0.3.1), then appends
# -rc.<run> (0.3.1-rc.42), so it never stamps an already-shipped version,
# sorts between 0.3.0 and 0.3.1, and is recognised as a test build
# (ui/mod.rs, kiri-win). Releases take theirs from the tag instead.
# scripts/ci/test-version.sh
set -eu
last=$(curl -fsS --max-time 20 -A kiri-ci "${KIRI_LATEST_URL:-https://download.runkiri.com/latest.json}" | grep -Eo '"version":[[:space:]]*"[0-9]+\.[0-9]+\.[0-9]+"' | head -1 | sed -n 's/.*"\([0-9]*\.[0-9]*\.[0-9]*\)".*/\1/p' || true)
if [ -n "$last" ]; then
next=$(printf '%s\n' "$last" | awk -F. '{printf "%d.%d.%d", $1, $2, $3 + 1}')
else
next=0.0.1
fi
v="${next}-rc.${GITHUB_RUN_NUMBER:-0}"
perl -pi -e 's/^version = "[^"]*"/version = "'"$v"'"/ && ($done = 1) unless $done' Cargo.toml
grep -m1 '^version = ' Cargo.toml