Update version with Maven #16
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update version with Maven | |
on: | |
workflow_dispatch: | |
inputs: | |
update_type: | |
description: Update type | |
required: true | |
type: choice | |
options: | |
# `major` not yet supported | |
- minor | |
- bugfix | |
jobs: | |
update-version: | |
name: Update version | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create a branch | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git checkout -b issues/prepare-release-${{ github.run_number }} | |
git push origin issues/prepare-release-${{ github.run_number }} | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: 'temurin' | |
cache: maven | |
- name: Run Maven release:prepare # https://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.html | |
run: | | |
echo ${{ inputs.update_type }} | |
if [ ${{ inputs.update_type }} == "minor" ]; then | |
mvn -B -U release:prepare -DtagNameFormat=@{project.version} -DprojectVersionPolicyId=SemVerVersionPolicy | |
elif [ ${{ inputs.update_type }} == "bugfix" ]; then | |
mvn -B -U release:prepare -DtagNameFormat=@{project.version} | |
else | |
echo "Not supported type: ${{ inputs.update_type }}" | |
exit 1 | |
fi | |
- name: Create pull request | |
run: gh pr create --base ${{ github.ref_name }} --fill | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |