Skip to content

Update GHA used jdks, prevent the sonatype deploy on forks or immediately after release, and adjust profiles #63

Update GHA used jdks, prevent the sonatype deploy on forks or immediately after release, and adjust profiles

Update GHA used jdks, prevent the sonatype deploy on forks or immediately after release, and adjust profiles #63

Workflow file for this run

name: Maven Build and Deployment
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: Java Latest LTS Build and Verify
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Set up Java and Maven
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 21
cache: maven
- name: Build with Maven
run: mvn -B verify
- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v3
compatibility-checks:
runs-on: ubuntu-latest
strategy:
matrix:
java: [7, 8, 11, 17, 21]
name: Java ${{ matrix.java }} Compatibility
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Set up Java and Maven
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: ${{ matrix.java }}
cache: maven
- name: Test with Maven
run: mvn -B test
deploy:
name: Deploy to OSSRH
needs: [build, compatibility-checks]
if: github.event_name == 'push' && github.repository_owner == 'acegi' && ! contains(toJSON(github.event.head_commit.message), '[maven-release-plugin]')
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Set up Java and Maven
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
cache: maven
- name: Set up Java and Maven
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.gpg_private_key }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish Maven package
run: mvn -Possrh-deploy deploy
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.gpg_passphrase }}
MAVEN_USERNAME: ${{ secrets.nexus_username }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.nexus_password }}