From 7bc20e38e2a32f44009db3001a039dc19a65107f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Mata?= Date: Sun, 25 Jan 2026 20:33:42 +0100 Subject: [PATCH] Generalize pre-release bump workflow (#779) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Generalize pre-release bump workflow Handle alpha, beta, and rc tags when incrementing the version. * Change commit message for version bump in workflow Signed-off-by: Juan José Mata --------- Signed-off-by: Juan José Mata --- .github/workflows/publish.yml | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 440bb39a4..2c3479071 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -329,9 +329,9 @@ jobs: > **Note**: These are debug builds intended for testing purposes. For production use, please build from source with proper signing credentials. - bump-alpha-version: - name: Bump Alpha Version - if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref_name, 'alpha') + bump-pre_release-version: + name: Bump Pre-release Version + if: startsWith(github.ref, 'refs/tags/v') && (contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc')) needs: [merge] runs-on: ubuntu-latest timeout-minutes: 10 @@ -346,7 +346,7 @@ jobs: ref: main token: ${{ secrets.GH_PAT }} - - name: Bump alpha version + - name: Bump pre-release version run: | VERSION_FILE="config/initializers/version.rb" @@ -357,20 +357,26 @@ jobs: fi # Extract current version - CURRENT_VERSION=$(grep -oP '"\K[0-9]+\.[0-9]+\.[0-9]+-alpha\.[0-9]+' "$VERSION_FILE") + CURRENT_VERSION=$(grep -oP '"\K[0-9]+\.[0-9]+\.[0-9]+-(alpha|beta|rc)\.[0-9]+' "$VERSION_FILE") if [ -z "$CURRENT_VERSION" ]; then echo "ERROR: Could not extract version from $VERSION_FILE" exit 1 fi echo "Current version: $CURRENT_VERSION" - - # Extract the alpha number and increment it - ALPHA_NUM=$(echo "$CURRENT_VERSION" | grep -oP 'alpha\.\K[0-9]+') - if [ -z "$ALPHA_NUM" ]; then - echo "ERROR: Could not extract alpha number from $CURRENT_VERSION" + + # Extract the pre-release tag and number, then increment it + PRE_RELEASE_TAG=$(echo "$CURRENT_VERSION" | grep -oP '(alpha|beta|rc)') + if [ -z "$PRE_RELEASE_TAG" ]; then + echo "ERROR: Could not extract pre-release tag from $CURRENT_VERSION" exit 1 fi - NEW_ALPHA_NUM=$((ALPHA_NUM + 1)) + + PRE_RELEASE_NUM=$(echo "$CURRENT_VERSION" | grep -oP '(alpha|beta|rc)\.\K[0-9]+') + if [ -z "$PRE_RELEASE_NUM" ]; then + echo "ERROR: Could not extract pre-release number from $CURRENT_VERSION" + exit 1 + fi + NEW_PRE_RELEASE_NUM=$((PRE_RELEASE_NUM + 1)) # Create new version string BASE_VERSION=$(echo "$CURRENT_VERSION" | grep -oP '^[0-9]+\.[0-9]+\.[0-9]+') @@ -378,7 +384,7 @@ jobs: echo "ERROR: Could not extract base version from $CURRENT_VERSION" exit 1 fi - NEW_VERSION="${BASE_VERSION}-alpha.${NEW_ALPHA_NUM}" + NEW_VERSION="${BASE_VERSION}-${PRE_RELEASE_TAG}.${NEW_PRE_RELEASE_NUM}" echo "New version: $NEW_VERSION" # Update the version file @@ -401,7 +407,7 @@ jobs: exit 0 fi - git commit -m "Bump version to next alpha after ${{ github.ref_name }} release" + git commit -m "Bump version to next iteration after ${{ github.ref_name }} release" # Push with retry logic attempts=0