Skip to content

Bump Java 17 for Sonar job #4

Bump Java 17 for Sonar job

Bump Java 17 for Sonar job #4

name: Build and Publish Snapshot
on:
push:
branches:
- master
tags-ignore:
- '**'
paths-ignore:
- '**.md'
env:
MAVEN_OPTS: ${{ vars.MAVEN_OPTS }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn --batch-mode --update-snapshots package
- name: Import GPG key
run: |
echo "${{ secrets.OSSRH_GPG_SECRET_KEY }}" | base64 --decode | gpg --import --batch
- name: Publish Snapshot to OSS SonaType
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USER }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
OSSRH_GPG_SECRET_KEY_ID: ${{ secrets.OSSRH_GPG_SECRET_KEY_ID }}
OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
run: |
mvn --batch-mode --no-transfer-progress deploy \
-DskipTests \
-Dgpg.keyname=${OSSRH_GPG_SECRET_KEY_ID} \
-Dgpg.passphrase=${OSSRH_GPG_SECRET_KEY_PASSWORD}
- name: Notify on success
if: success()
run: |
echo "Snapshot has been successfully deployed to OSS SonaType."
- name: Notify on failure
if: failure()
run: |
echo "Snapshot deployment failed. Please check the logs for more information."