Skip to content

Commit 79c8f47

Browse files
GHA-209 Support bumping version with maven (#113)
1 parent 17f0010 commit 79c8f47

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

.github/workflows/automated-release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ on:
148148
description: "Comma-separated list of module to exclude from the version bump commit."
149149
required: false
150150
type: string
151+
bump-version-tool:
152+
description: "Version bumping tool to use. Supported values: 'maven'. Leave empty to use the default shell-based solution."
153+
required: false
154+
type: string
151155

152156
outputs:
153157
new-version:
@@ -515,6 +519,7 @@ jobs:
515519
pr-labels: ${{ inputs.bump-version-pr-lables }}
516520
excluded-modules: ${{ inputs.bump-version-exlusions }}
517521
base-branch: ${{ inputs.branch }}
522+
tool: ${{ inputs.bump-version-tool }}
518523

519524
# This step creates integration tickets in various Jira projects based on the inputs provided.
520525
# It creates tickets for SLVS, SLVSCODE, SLE, SLI, SQC, and SQS as specified.

bump-version/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This action updates the version in Maven and Gradle files across your repository
1111
| excluded-modules | Comma-separated list of modules to exclude from version bumping | No | |
1212
| base-branch | The base branch for the pull request | No | `master` |
1313
| pr-labels | Comma-separated list of labels to add to the pull request | No | |
14+
| tool | Version bumping tool to use. Supported values: `maven`. Leave empty to use the default shell-based solution. | No | |
1415

1516
## Outputs
1617

@@ -34,6 +35,6 @@ This action updates the version in Maven and Gradle files across your repository
3435
```
3536
3637
## How it works
37-
- Updates all `pom.xml` and `gradle.properties` files to the new version.
38-
- Skips files in modules listed in `excluded-modules`.
38+
- If `tool` is set to `maven`, runs `mvn versions:set` to update the version.
39+
- Otherwise, updates all `pom.xml` and `gradle.properties` files to the new version, skipping modules listed in `excluded-modules`.
3940
- Commits changes and creates a pull request.

bump-version/action.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,35 @@ inputs:
1717
pr-labels:
1818
description: Comma-separated list of labels to add to the pull request
1919
required: false
20+
tool:
21+
description: "Version bumping tool to use. Supported values: 'maven'. Leave empty to use the default shell-based solution."
22+
required: false
2023

2124
runs:
2225
using: 'composite'
2326
steps:
2427
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
28+
2529
- name: Bump version
2630
shell: bash
2731
env:
32+
TOOL: ${{ inputs.tool }}
2833
VERSION: "${{ inputs.version }}-SNAPSHOT"
2934
EXCLUDED_MODULES: ${{ inputs.excluded-modules || '' }}
3035
run: |
31-
bash "${GITHUB_ACTION_PATH}/bump_version.sh"
36+
case "$TOOL" in
37+
maven)
38+
mvn versions:set -DgenerateBackupPoms=false -DnewVersion="${VERSION}"
39+
;;
40+
'')
41+
bash "${GITHUB_ACTION_PATH}/bump_version.sh"
42+
;;
43+
*)
44+
echo "Unsupported version bumping tool: $TOOL"
45+
exit 1
46+
;;
47+
esac
48+
3249
- name: Create Pull Request for Version Bump
3350
uses: SonarSource/release-github-actions/create-pull-request@v1
3451
id: create-pr

0 commit comments

Comments
 (0)