Skip to content

Bump project version to 2.12.0 in all POM files #516

Bump project version to 2.12.0 in all POM files

Bump project version to 2.12.0 in all POM files #516

Workflow file for this run

name: Build
on:
push:
branches:
- '**'
tags-ignore:
- '**'
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows reuse of this workflow as a generic "Java build with Maven that publishes to main on merge"
workflow_call:
outputs:
release-version:
description: The version of the new release built on the main branch.
value: ${{ jobs.build_main_branch.outputs.release-version }}
jobs:
build_feature_branch:
name: Build feature branch
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main' || github.repository != 'BetonQuest/MavenSetup'
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Determine Java version
uses: BetonQuest/java-version-export-github-action@main
id: determine-java-version
with:
maven-expression: 'java.api.version'
- name: Setup Java and Maven
uses: actions/setup-java@v5.6.0
with:
distribution: temurin
java-version: ${{ steps.determine-java-version.outputs.java_major_version }}
cache: maven
- name: Build with Maven verify
run: |
./mvnw --batch-mode verify
build_main_branch:
name: Build main branch
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.repository == 'BetonQuest/MavenSetup'
outputs:
release-version: ${{ steps.set-version.outputs.release-version }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Determine Java version
uses: BetonQuest/java-version-export-github-action@main
id: determine-java-version
with:
maven-expression: 'java.api.version'
- name: Setup Java and Maven
uses: actions/setup-java@v5.6.0
with:
distribution: temurin
java-version: ${{ steps.determine-java-version.outputs.java_major_version }}
cache: 'maven'
server-id: betonquest
server-username: MAVEN_SERVER_USERNAME
server-password: MAVEN_SERVER_PASSWORD
- name: Read revision version from pom.xml
shell: bash
run: |
# Using mvnd – need --raw-streams --non-recursive for proper output, fix for https://github.com/apache/maven-mvnd/issues/1026
REVISION_VERSION="$(./mvnw --raw-streams --non-recursive help:evaluate -Dexpression=revision -DforceStdout -q)"
echo "REVISION_VERSION=$REVISION_VERSION" >> $GITHUB_ENV
- name: Check if revision is already tagged
shell: bash
run: |
if git tag -l v${REVISION_VERSION} | grep -q v$REVISION_VERSION; then
echo "Revision $REVISION_VERSION is already tagged. Skipping deployment."
exit 0
else
DEPLOY_RELEASE=true
echo "DEPLOY_RELEASE=$DEPLOY_RELEASE" >> $GITHUB_ENV
fi
- name: Build with Maven deploy
if: env.DEPLOY_RELEASE == 'true'
env:
MAVEN_SERVER_USERNAME: ${{ secrets.MAVEN_SERVER_USERNAME }}
MAVEN_SERVER_PASSWORD: ${{ secrets.MAVEN_SERVER_PASSWORD }}
run: |
./mvnw --batch-mode deploy -Dchangelist= -DskipShade
- name: Create new git tag
if: env.DEPLOY_RELEASE == 'true'
uses: rickstaa/action-create-tag@v1
with:
tag: v${{ env.REVISION_VERSION }}
message: Release ${{ env.REVISION_VERSION }}
- name: Set version output
id: set-version
if: env.DEPLOY_RELEASE == 'true'
run: echo "release-version=${REVISION_VERSION}" >> $GITHUB_OUTPUT