fix: support legacy and beta prerelease version formats

This commit is contained in:
Peter Steinberger
2026-02-24 02:05:29 +00:00
parent 08e2aa44e7
commit 6c441ea797
8 changed files with 152 additions and 8 deletions

View File

@@ -19,7 +19,8 @@ ZIP_NAME=$(basename "$ZIP")
ZIP_BASE="${ZIP_NAME%.zip}"
VERSION=${SPARKLE_RELEASE_VERSION:-}
if [[ -z "$VERSION" ]]; then
if [[ "$ZIP_NAME" =~ ^OpenClaw-([0-9]+(\.[0-9]+){1,2}([-.][^.]*)?)\.zip$ ]]; then
# Accept legacy calver suffixes like -1 and prerelease forms like -beta.1 / .beta.1.
if [[ "$ZIP_NAME" =~ ^OpenClaw-([0-9]+(\.[0-9]+){1,2}([-.][0-9A-Za-z]+([.-][0-9A-Za-z]+)*)?)\.zip$ ]]; then
VERSION="${BASH_REMATCH[1]}"
else
echo "Could not infer version from $ZIP_NAME; set SPARKLE_RELEASE_VERSION." >&2

View File

@@ -22,7 +22,12 @@ type PackageJson = {
};
function normalizePluginSyncVersion(version: string): string {
return version.replace(/[-+].*$/, "");
const normalized = version.trim().replace(/^v/, "");
const base = /^([0-9]+\.[0-9]+\.[0-9]+)/.exec(normalized)?.[1];
if (base) {
return base;
}
return normalized.replace(/[-+].*$/, "");
}
function runPackDry(): PackResult[] {