fix(ci): check-version.sh 兼容预发布 tag (v0.6.0-rc1 / beta / alpha)

- 预发布标签在比较时也剥离 -rc1 / -beta.2 / -alpha.3 等后缀
- 允许用户复用已发布的版本文件来打预发布
- 显式不匹配仍正常工作
This commit is contained in:
954801926@qq.com authored and KimiSwitch Dev committed 2026-08-01 09:53:42 +08:00
1 parent c6da421d2f
commit 6b867ff6fc
1 file changed
+5
+5
View File
@@ -16,6 +16,11 @@ fi
# Strip leading 'v' for comparison (we expect semver without v) # Strip leading 'v' for comparison (we expect semver without v)
EXPECTED_BARE="${EXPECTED#v}" EXPECTED_BARE="${EXPECTED#v}"
# Strip common prerelease suffixes (-rc1, -beta.2, -alpha.3, etc.) so a
# v0.6.0-rc1 tag can reuse the existing 0.6.0 versions in the project files.
# If the project does want a separate prerelease version, it must be
# committed explicitly to the three version files.
EXPECTED_BARE="${EXPECTED_BARE%%-*}"
PKG_VERSION=$(node -p "require('./package.json').version") PKG_VERSION=$(node -p "require('./package.json').version")
CARGO_VERSION=$(grep -E '^version\s*=' src-tauri/Cargo.toml | head -1 | sed -E 's/.*"([^"]+)".*/\1/') CARGO_VERSION=$(grep -E '^version\s*=' src-tauri/Cargo.toml | head -1 | sed -E 's/.*"([^"]+)".*/\1/')