From 0c235b34c776c6f5fbe78e56ebe0f54de0c416ed Mon Sep 17 00:00:00 2001 From: Thibault Pensec Date: Tue, 11 Aug 2026 13:12:04 +0200 Subject: [PATCH] fix(ci): accept SemVer pre-release tags in release workflow The release workflow rejected 'v4.0.0-alpha.1' because the tag regex only matched vMAJOR.MINOR.PATCH. Allow optional SemVer pre-release and build-metadata suffixes so alpha/beta/rc tags can be released. Also accept the 'next' branch as a valid release source for 4.x, since 4.x is developed on 'next' until GA merges it into 'main'. --- .github/workflows/release.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf7d172dc..b0b34de91 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,8 +20,9 @@ jobs: id: version run: | TAG="${{ github.event.release.tag_name }}" - if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "::error::Release tag '$TAG' is not in the expected vMAJOR.MINOR.PATCH format (e.g. v3.3.16)" + # vMAJOR.MINOR.PATCH with optional SemVer pre-release (-alpha.1) and build metadata (+build.5) + if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then + echo "::error::Release tag '$TAG' is not in the expected vMAJOR.MINOR.PATCH[-prerelease][+build] format (e.g. v3.3.16 or v4.0.0-alpha.1)" exit 1 fi VERSION="${TAG#v}" @@ -31,8 +32,9 @@ jobs: echo "::error::Release tag '$TAG' is a v3.x release but targets '$TARGET' instead of the '3.x' branch" exit 1 fi - if [[ "$MAJOR" != "3" && "$TARGET" != "main" ]]; then - echo "::error::Release tag '$TAG' is a v${MAJOR}.x release but targets '$TARGET' instead of 'main'" + # 4.x is developed on 'next' until GA merges it to 'main'; both branches are valid release sources. + if [[ "$MAJOR" != "3" && "$TARGET" != "main" && "$TARGET" != "next" ]]; then + echo "::error::Release tag '$TAG' is a v${MAJOR}.x release but targets '$TARGET' instead of 'main' or 'next'" exit 1 fi echo "version=$VERSION" >> "$GITHUB_OUTPUT"