From 367651d43230563123628d35a4435e0d05759ca6 Mon Sep 17 00:00:00 2001 From: anomiex Date: Mon, 9 Dec 2024 15:31:34 +0000 Subject: [PATCH] autorelease: Fix rolling-release version for a release (#40522) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because PHP's `version_compare()` is used for the comparison, something like `6.0.0+rolling.12345.gbeef` < `6.0.0-alpha+rolling.12345.gbeef`. To avoid this being a problem, if the version number isn't already -alpha then bump it as for a point release, e.g. `6.0.0` → `6.0.1-alpha`. Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/12238610275 Upstream-Ref: Automattic/jetpack@d6205c249c1ca8648242cb2281a02109e9ed32dd --- .github/files/autorelease.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/files/autorelease.sh b/.github/files/autorelease.sh index b4ac6030..5a5f47c9 100755 --- a/.github/files/autorelease.sh +++ b/.github/files/autorelease.sh @@ -28,6 +28,11 @@ elif [[ "$GITHUB_REF" == "refs/heads/trunk" ]]; then fi ROLLING_MODE=true CURRENT_VER=$( sed -nEe 's/^## \[?([^]]*)\]? - .*/\1/;T;p;q' CHANGELOG.md || true ) + if [[ "$CURRENT_VER" != *-alpha ]]; then + # Bump a non-alpha release to the next alpha to avoid confusing version_compare. + CURRENT_VER=${CURRENT_VER%%-*} + CURRENT_VER=${CURRENT_VER%.*}.$(( ${CURRENT_VER##*.} + 1 ))-alpha + fi GIT_SUFFIX=$( git log -1 --format="%ct.g%h" . ) TAG="$CURRENT_VER+rolling.$GIT_SUFFIX" else