Skip to content

Release

Release #19

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Set Release version env variable
run: |
echo "TAG_NAME=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
# if no tag exists, this is expected to fail
- name: Switch to git tag for release
if: contains(env.TAG_NAME, 'SNAPSHOT') != true
run: |
git fetch --all --tags
git checkout tags/${{ env.TAG_NAME }} -b ${{ env.TAG_NAME }}-tmp-branch
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
server-id: sonatype-nexus
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-passphrase: MAVEN_GPG_PASSPHRASE
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
- name: Deploy
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_PASSWORD }}
run: |
./mvnw --batch-mode clean deploy
- name: Create GHA release
uses: ncipollo/release-action@v1
if: contains(env.TAG_NAME, 'SNAPSHOT') != true
with:
artifacts: "target/*.jar"
bodyFile: RELEASE.md