Skip to content

4.1.2

4.1.2 #91

Workflow file for this run

name: Publish release
on:
release:
types: [published]
jobs:
publish-release:
runs-on: ubuntu-latest
steps:
- name: Checkout latest code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
cache: maven
- name: Setup build cache
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Publish artifact to central
env:
NEW_VERSION: ${{ github.event.release.tag_name }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
GPG_KEYS: ${{ secrets.GPG_KEYS }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
export GPG_TTY=$(tty) && echo "$GPG_KEYS" | gpg --fast-import --batch
echo "-- Setting new release version ${NEW_VERSION} --"
./mvnw -B versions:set -DnewVersion="${NEW_VERSION}" -DgenerateBackupPoms=false
echo "-- Build, test and deploy release to Sonatype --"
./mvnw -B --settings .github/settings.xml clean deploy -Prelease,deploy-to-sonatype -Dmaven.wagon.http.pool=false
# - name: Publish artifact to GPR
# env:
# NEW_VERSION: ${{ github.event.release.tag_name }}
# GITHUB_USERNAME: x-access-token
# GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# git config user.email "[email protected]"
# git config user.name "GitHub Actions release"
# ./mvnw --settings .github/settings.xml -Pgithub --batch-mode -Dmaven.main.skip=true -Dmaven.test.skip=true deploy