Skip to content

Release new version #121

Release new version

Release new version #121

Workflow file for this run

name: Release new version
on:
workflow_dispatch:
inputs:
adjustment:
description: 'Release increment type. Defaults to "minor", available values are "major", "minor" and "patch"'
required: true
default: 'minor'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout project files
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version-file: '.java-version'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B --show-version validate
- name: Show git information
run: |
git status
git log --no-color --graph --oneline -n 10
git tag --list
- name: Use provided version increment adjustment
if: ${{ github.event_name == 'workflow_dispatch' }}
run: echo "VERSION_ADJUSTMENT=${{ github.event.inputs.adjustment }}" >> $GITHUB_ENV
- name: Detect version increment adjustment
if: ${{ github.event_name != 'workflow_dispatch' }}
run: echo "VERSION_ADJUSTMENT=minor" >> $GITHUB_ENV
- name: Extract next MAJOR version
if: "${{ env.VERSION_ADJUSTMENT == 'major' }}"
run: echo "VERSION_STRING=$(mvn --quiet build-helper:parse-version -Dexec.executable=echo -Dexec.args='${parsedVersion.nextMajorVersion}.0.0' --non-recursive exec:exec)" >> $GITHUB_ENV
- name: Extract next MINOR version
if: "${{ env.VERSION_ADJUSTMENT == 'minor' }}"
run: echo "VERSION_STRING=$(mvn --quiet build-helper:parse-version -Dexec.executable=echo -Dexec.args='${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion}.0' --non-recursive exec:exec)" >> $GITHUB_ENV
- name: Extract next PATCH version
if: "${{ env.VERSION_ADJUSTMENT == 'patch' }}"
run: echo "VERSION_STRING=$(mvn --quiet build-helper:parse-version -Dexec.executable=echo -Dexec.args='${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion}' --non-recursive exec:exec)" >> $GITHUB_ENV
- name: Create tag
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/v${{ env.VERSION_STRING }}",
sha: context.sha
})