Update version to 3.0.1-SNAPSHOT in pom.xml #304
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
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created | |
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path | |
name: Maven Publish Master On Push | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "*" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 for Github deployment | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | |
settings-path: ${{ github.workspace }} # location for the settings.xml file | |
- name: Read Maven project version | |
id: read_version | |
run: | | |
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
echo "version=${version}" >> $GITHUB_OUTPUT | |
- name: Check version properties | |
id: check_release | |
run: | | |
version="${{ steps.read_version.outputs.version }}" | |
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+-SNAPSHOT$ ]]; then | |
echo "is_snapshot=true" >> $GITHUB_OUTPUT | |
else | |
echo "is_snapshot=false" >> $GITHUB_OUTPUT | |
fi | |
if [[ ${{ github.ref }} == 'refs/tags/'* ]]; then | |
echo "has_tag=true" >> $GITHUB_OUTPUT | |
else | |
echo "has_tag=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Publish to GitHub Packages Apache Maven | |
if: steps.check_release.outputs.is_snapshot == 'true' || steps.check_release.outputs.is_snapshot == 'false' && steps.check_release.outputs.has_tag == 'true' | |
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Set up JDK 17 for NERZ-Snapshot-Deployment | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
server-id: nerz-snapshots | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
- name: Publish Snapshots to NERZ Nexus | |
if: steps.check_release.outputs.is_snapshot == 'true' | |
run: | | |
echo "Ist ein Snapshot: ${{ steps.check_release.outputs.is_snapshot }} und hat einen Tag ${{ steps.check_release.outputs.has_tag }}" | |
mvn deploy -P nerz | |
env: | |
MAVEN_USERNAME: ${{ secrets.NERZ_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.NERZ_TOKEN }} | |
- name: Set up JDK 17 for NERZ-Release-Deployment | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
server-id: nerz-releases | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
- name: Publish Releases to NERZ Nexus | |
if: steps.check_release.outputs.is_snapshot == 'false' && steps.check_release.outputs.has_tag == 'true' | |
run: | | |
echo "Ist ein Snapshot: ${{ steps.check_release.outputs.is_snapshot }}" | |
mvn deploy -P nerz | |
env: | |
MAVEN_USERNAME: ${{ secrets.NERZ_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.NERZ_TOKEN }} | |