From 638f51cf1ff12794ff18c23290ea20be652397ff Mon Sep 17 00:00:00 2001 From: Tomasz Tylenda Date: Fri, 27 Feb 2026 11:09:31 +0100 Subject: [PATCH 1/5] Normalize Jira version to full "major.minor.patch" in bump-version --- .github/workflows/automated-release.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/automated-release.yml b/.github/workflows/automated-release.yml index c3b3879..e957c22 100644 --- a/.github/workflows/automated-release.yml +++ b/.github/workflows/automated-release.yml @@ -482,10 +482,25 @@ jobs: contents: write pull-requests: write steps: + # We need the full "major.minor.patch" format, + # but release-in-jira step drops the patch if it is 0. + - name: Normalize Version + id: normalize + shell: bash + env: + INPUT: ${{ needs.release-in-jira.outputs.new-version }} + run: | + if [[ $INPUT =~ ^[0-9]+\.[0-9]+$ ]]; then + OUTPUT="${INPUT}.0" + else + OUTPUT="$INPUT" + fi + echo "version=${OUTPUT}" >> "$GITHUB_OUTPUT" + - name: Bump version and create PR uses: SonarSource/release-github-actions/bump-version@v1 with: - version: ${{ needs.release-in-jira.outputs.new-version }} + version: ${{ steps.normalize.outputs.version }} pr-labels: ${{ inputs.bump-version-pr-lables }} excluded-modules: ${{ inputs.bump-version-exlusions }} base-branch: ${{ inputs.branch }} From 10816b14aa32e101052752c701e18e903e67fc76 Mon Sep 17 00:00:00 2001 From: Tomasz Tylenda Date: Fri, 27 Feb 2026 11:36:36 +0100 Subject: [PATCH 2/5] Make normalization optional --- .github/workflows/automated-release.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/automated-release.yml b/.github/workflows/automated-release.yml index e957c22..16d1d6b 100644 --- a/.github/workflows/automated-release.yml +++ b/.github/workflows/automated-release.yml @@ -135,6 +135,11 @@ on: required: false type: boolean default: false + bump-version-normalize: + description: "If true, the version will have full major.minor.patch format, otherwise the final .0 is dropped." + required: false + type: boolean + default: false bump-version-pr-lables: description: "Labels to apply to the version bump pull request if bump-version is true. For example, 'update-next-dev,skip-qa'." required: false @@ -482,15 +487,16 @@ jobs: contents: write pull-requests: write steps: - # We need the full "major.minor.patch" format, - # but release-in-jira step drops the patch if it is 0. + # If requested, convert the version returned by release-in-jira + # to the full "major.minor.patch" format (it drops the patch if it is 0). - name: Normalize Version id: normalize shell: bash env: + NORMALIZE: ${{ inputs.bump-version-normalize }} INPUT: ${{ needs.release-in-jira.outputs.new-version }} run: | - if [[ $INPUT =~ ^[0-9]+\.[0-9]+$ ]]; then + if [[ $NORMALIZE == 'true' && $INPUT =~ ^[0-9]+\.[0-9]+$ ]]; then OUTPUT="${INPUT}.0" else OUTPUT="$INPUT" From f3837a60c30ff3877396572137bb801fc2ebc3bb Mon Sep 17 00:00:00 2001 From: Tomasz Tylenda Date: Fri, 27 Feb 2026 11:42:56 +0100 Subject: [PATCH 3/5] Assign INPUT directly in the script --- .github/workflows/automated-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/automated-release.yml b/.github/workflows/automated-release.yml index 16d1d6b..4c25dcc 100644 --- a/.github/workflows/automated-release.yml +++ b/.github/workflows/automated-release.yml @@ -494,8 +494,8 @@ jobs: shell: bash env: NORMALIZE: ${{ inputs.bump-version-normalize }} - INPUT: ${{ needs.release-in-jira.outputs.new-version }} run: | + INPUT="${{ needs.release-in-jira.outputs.new-version }}" if [[ $NORMALIZE == 'true' && $INPUT =~ ^[0-9]+\.[0-9]+$ ]]; then OUTPUT="${INPUT}.0" else From dd4d8f7cbaa75ce6af90950a56f702cb7bbf1c7f Mon Sep 17 00:00:00 2001 From: Tomasz Tylenda Date: Fri, 27 Feb 2026 11:44:26 +0100 Subject: [PATCH 4/5] Revert "Assign INPUT directly in the script" This reverts commit f3837a60c30ff3877396572137bb801fc2ebc3bb. --- .github/workflows/automated-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/automated-release.yml b/.github/workflows/automated-release.yml index 4c25dcc..16d1d6b 100644 --- a/.github/workflows/automated-release.yml +++ b/.github/workflows/automated-release.yml @@ -494,8 +494,8 @@ jobs: shell: bash env: NORMALIZE: ${{ inputs.bump-version-normalize }} + INPUT: ${{ needs.release-in-jira.outputs.new-version }} run: | - INPUT="${{ needs.release-in-jira.outputs.new-version }}" if [[ $NORMALIZE == 'true' && $INPUT =~ ^[0-9]+\.[0-9]+$ ]]; then OUTPUT="${INPUT}.0" else From d34c9fd6cc8373074ff941e8d6c3ee3184812d79 Mon Sep 17 00:00:00 2001 From: Tomasz Tylenda Date: Fri, 27 Feb 2026 13:00:32 +0100 Subject: [PATCH 5/5] Use `if:` --- .github/workflows/automated-release.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/automated-release.yml b/.github/workflows/automated-release.yml index 16d1d6b..3ddb57c 100644 --- a/.github/workflows/automated-release.yml +++ b/.github/workflows/automated-release.yml @@ -487,16 +487,15 @@ jobs: contents: write pull-requests: write steps: - # If requested, convert the version returned by release-in-jira - # to the full "major.minor.patch" format (it drops the patch if it is 0). + # Convert the version returned by release-in-jira to the full "major.minor.patch" format + # (it drops the patch if it is 0). - name: Normalize Version id: normalize + if: ${{ inputs.bump-version-normalize }} shell: bash - env: - NORMALIZE: ${{ inputs.bump-version-normalize }} - INPUT: ${{ needs.release-in-jira.outputs.new-version }} run: | - if [[ $NORMALIZE == 'true' && $INPUT =~ ^[0-9]+\.[0-9]+$ ]]; then + INPUT="${{ needs.release-in-jira.outputs.new-version }}" + if [[ $INPUT =~ ^[0-9]+\.[0-9]+$ ]]; then OUTPUT="${INPUT}.0" else OUTPUT="$INPUT" @@ -506,7 +505,7 @@ jobs: - name: Bump version and create PR uses: SonarSource/release-github-actions/bump-version@v1 with: - version: ${{ steps.normalize.outputs.version }} + version: ${{ steps.normalize.outputs.version || needs.release-in-jira.outputs.new-version }} pr-labels: ${{ inputs.bump-version-pr-lables }} excluded-modules: ${{ inputs.bump-version-exlusions }} base-branch: ${{ inputs.branch }}