diff --git a/.github/workflows/automated-release.yml b/.github/workflows/automated-release.yml index c3b3879..3ddb57c 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,10 +487,25 @@ jobs: contents: write pull-requests: write steps: + # 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 + run: | + INPUT="${{ needs.release-in-jira.outputs.new-version }}" + 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 || needs.release-in-jira.outputs.new-version }} pr-labels: ${{ inputs.bump-version-pr-lables }} excluded-modules: ${{ inputs.bump-version-exlusions }} base-branch: ${{ inputs.branch }}