Bump actions/checkout from 3 to 4 #133
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: Java with Maven | |
on: [ push, pull_request ] | |
jobs: | |
build-and-test-job: | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
strategy: | |
fail-fast: false | |
matrix: | |
java: [ 17 ] | |
os: [ ubuntu-latest, macOS-latest, windows-latest ] | |
name: JDK${{ matrix.java }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
cache: 'maven' | |
- name: Build and (headless) test with Maven | |
uses: smithki/[email protected] | |
with: | |
run: mvn -U -B -ntp package | |
snapshot-job: | |
needs: build-and-test-job | |
if: startsWith(github.repository, 'jdemetra/') && startsWith(github.ref, 'refs/heads/develop') | |
strategy: | |
matrix: | |
java: [ 17 ] | |
os: [ ubuntu-latest ] | |
name: Snapshot on develop | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
cache: 'maven' | |
- name: Deploy snapshot with Maven if settings defined | |
run: test ! -f ci.settings.xml || mvn -B -ntp deploy -DskipTests -s ci.settings.xml -P base-deploy,snapshot-deploy,!non-deployable-modules | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
SIGN_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
SIGN_KEY_PASS: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
- name: Dryrun release assets with Maven | |
run: mvn -B -ntp install -DskipTests -P full-release -Djreleaser.output.directory=$PWD/out/jreleaser -Djreleaser.dry.run | |
env: | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }} | |
JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
- name: Upload JReleaser output | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: assets-snapshot-log | |
path: | | |
out/jreleaser/trace.log | |
out/jreleaser/output.properties | |
release-job: | |
needs: build-and-test-job | |
if: startsWith(github.repository, 'jdemetra/') && startsWith(github.ref, 'refs/tags/v') | |
strategy: | |
matrix: | |
java: [ 17 ] | |
os: [ ubuntu-latest ] | |
name: Release on tag | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
cache: 'maven' | |
- name: Deploy with Maven if settings defined | |
run: test ! -f ci.settings.xml || mvn -B -ntp deploy -DskipTests -s ci.settings.xml -P base-deploy,release-deploy,!non-deployable-modules | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
SIGN_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
SIGN_KEY_PASS: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
# Fix https://issues.sonatype.org/browse/OSSRH-66257 | |
MAVEN_OPTS: "--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED" | |
- name: Release assets with Maven | |
run: mvn -B -ntp install -DskipTests -P full-release -Djreleaser.output.directory=$PWD/out/jreleaser | |
env: | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }} | |
JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
- name: Upload JReleaser output | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: assets-release-log | |
path: | | |
out/jreleaser/trace.log | |
out/jreleaser/output.properties |