maven 3.8 #41
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
name: CI | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
concurrency: | |
group: ${{ github.workflow }} @ ${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: [ "*" ] | |
tags: [v*] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Build with Maven | |
run: mvn -B test --file pom.xml | |
publish: | |
name: Publish Artifacts | |
needs: [ build ] | |
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current branch (full) | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Java (temurin@17) | |
id: setup-java-temurin-17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
# Store the version, stripping any v-prefix | |
- name: Write release version | |
run: | | |
VERSION=${GITHUB_REF_NAME#v} | |
echo Version: $VERSION | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: set version | |
run: | | |
mvn versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false | |
- name: Import signing key | |
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' | |
env: | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
run: | | |
echo "$PGP_SECRET" | base64 -d -i - > /tmp/signing-key.gpg | |
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg | |
- name: Deploy release | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
run: | | |
mvn -Prelease --settings .github/release-settings.xml --batch-mode clean deploy |