Skip to content

Automatic bump after merge #46

Automatic bump after merge

Automatic bump after merge #46

Workflow file for this run

name: Bump POM
on:
push:
branches:
- master
jobs:
bump:
if: ${{ startsWith(github.event.head_commit.message, 'Merge pull request') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.CHECKOUT_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
cache: 'maven'
- name: Update major version when it is a major feature
run: >
mvn build-helper:parse-version versions:set
-DnewVersion="\${parsedVersion.nextMajorVersion}.0.0"
-DprocessAllModules versions:commit
if: ${{ contains(github.event.head_commit.message, 'major/') }}
- name: Update minor version when it is a feature
run: >
mvn build-helper:parse-version versions:set
-DnewVersion="\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0"
-DprocessAllModules versions:commit
if: ${{ contains(github.event.head_commit.message, 'feature/') }}
- name: Update patch version in case of bugfix or dependencies upgrade
run: >
mvn build-helper:parse-version versions:set
-DnewVersion="\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}"
-DprocessAllModules versions:commit
if: ${{ contains(github.event.head_commit.message, 'fix/') || contains(github.event.head_commit.message, 'clean/') || contains(github.event.head_commit.message, 'dependencies')}}
- name: Retrieve the new version
id: get-version
uses: JActions/[email protected]
- name: Commit and tag the new version
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Automatic bump after merge"
file_pattern: pom.xml **/pom.xml
commit_author: Github Action <[email protected]>
commit_user_name: github-actions
create_branch: false
tagging_message: ${{ steps.get-version.outputs.version }}