Skip to content

release version

release version #12

Workflow file for this run

# 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/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
name: Maven Package
on:
push:
branches:
- 'main'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY_MANUAL }}
persist-credentials: true
- name: set local github name
run: |
git config --local user.email "lars@lars-opitz.de"
git config --local user.name "GitHub Action"
- name: Set up build environment
uses: actions/setup-java@v3
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: Build with Maven
run: mvn -B package --file pom.xml
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v4
with:
servers: '[{ "id": "github", "privateKey": "${ secrets.SSH_PRIVATE_KEY_MANUAL }", "username": "${ github.actor }", "password": "${ secrets.SSH_PRIVATE_KEY_MANUAL }" }]'
- name: Maven stats
run: ./mvnw -version
- name: Bump to release version
run: ./mvnw -B org.codehaus.mojo:build-helper-maven-plugin:3.0.0:parse-version versions:set versions:commit -DnewVersion='${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}'
- name: Package
run: ./mvnw -B package
- name: Commit files
run: git commit -m "release version" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
ssh: true
- name: create tag
run: ./mvnw org.codehaus.mojo:exec-maven-plugin:1.6.0:exec -Dexec.executable="git" -Dexec.args='tag ${project.version}'
- name: Push changes
uses: ad-m/github-push-action@master
with:
tags: true
ssh: true
- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: Bump version to next dev version
run: ./mvnw -B org.codehaus.mojo:build-helper-maven-plugin:3.0.0:parse-version versions:set versions:commit -DnewVersion='${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion}.0-SNAPSHOT'
- name: Commit files
run: git commit -m "preparing next version" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
ssh: true