From a9844c42f4a0159a1861e1f76ded007497981aea Mon Sep 17 00:00:00 2001 From: m57 <41645758+Hy4ri@users.noreply.github.com> Date: Mon, 28 Sep 2026 21:09:47 +0300 Subject: [PATCH] fix(ci): compute strictly monotonic SemVer versionCode for releases (#1365) --- .github/workflows/release.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 48ce2ab6..956384c5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,10 +54,13 @@ jobs: # Strip leading 'v' for versionName VERSION="${TAG#v}" echo "version=$VERSION" >> "$GITHUB_OUTPUT" - # versionCode: strip pre-release suffixes (e.g. 1.25.0-rc1 -> 1.25.0) and dots + # versionCode: SemVer MAJOR * 10000 + MINOR * 100 + PATCH (e.g. 2.0.0 -> 20000, > 1.31.0's 1310) BASE_VERSION="${VERSION%%-*}" - CODE=$(echo "$BASE_VERSION" | tr -d '.' | sed 's/^0*//') - [ -z "$CODE" ] && CODE=0 + IFS='.' read -r MAJOR MINOR PATCH _ <<< "$BASE_VERSION" + MAJOR="${MAJOR:-0}" + MINOR="${MINOR:-0}" + PATCH="${PATCH:-0}" + CODE=$(( MAJOR * 10000 + MINOR * 100 + PATCH )) echo "code=$CODE" >> "$GITHUB_OUTPUT" if [[ "$VERSION" == *"-"* ]]; then PRERELEASE="true"