Skip to content

Bump actions/checkout from 4.3.1 to 6.0.2 #16

Bump actions/checkout from 4.3.1 to 6.0.2

Bump actions/checkout from 4.3.1 to 6.0.2 #16

Workflow file for this run

name: CI
on:
push:
branches:
- master
tags:
- '*'
pull_request: {}
permissions: {}
jobs:
build-test-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Set up Java
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
with:
distribution: 'temurin'
java-version: '21'
- name: Get version from POM
id: version
if: github.event_name == 'push'
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "version=$VERSION" | tee -a "$GITHUB_OUTPUT"
echo "is_snapshot=$(echo "$VERSION" | grep -q SNAPSHOT && echo true || echo false)" | tee -a "$GITHUB_OUTPUT"
- name: Set up Maven Central credentials for SNAPSHOT
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
with:
distribution: 'temurin'
java-version: '21'
server-id: central
server-username: CENTRAL_SONATYPE_USERNAME
server-password: CENTRAL_SONATYPE_PASSWORD
gpg-private-key: ${{ secrets.GPG_TEST_PRIV_KEY }}
gpg-passphrase: GPG_TEST_PASSPHRASE
if: github.event_name == 'push' && steps.version.outputs.is_snapshot == 'true'
- name: Set up Maven Central credentials for release
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
with:
distribution: 'temurin'
java-version: '21'
server-id: central
server-username: CENTRAL_SONATYPE_USERNAME
server-password: CENTRAL_SONATYPE_PASSWORD
gpg-private-key: ${{ secrets.GPG_RELEASE_PRIV_KEY }}
gpg-passphrase: GPG_RELEASE_PASSPHRASE
if: github.event_name == 'push' && steps.version.outputs.is_snapshot != 'true' && startsWith(github.ref, 'refs/tags/')
- name: Download dependencies
run: mvn --batch-mode dependency:go-offline
- name: Build
run: mvn --batch-mode clean compile
- name: Test
run: mvn --batch-mode test
- name: Build javadoc
run: mvn --batch-mode javadoc:javadoc
- name: Package without gpg
if: github.event_name != 'push'
run: mvn --batch-mode package -Dmaven.test.skip=true -Dgpg.skip=true
# Both "Deploy..." steps are calling the same, but separated to have clearer logs
- name: Deploy SNAPSHOT
if: github.event_name == 'push' && steps.version.outputs.is_snapshot == 'true'
run: mvn --batch-mode deploy
env:
CENTRAL_SONATYPE_USERNAME: ${{ secrets.CENTRAL_SONATYPE_USERNAME }}
CENTRAL_SONATYPE_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_PASSWORD }}
GPG_TEST_PASSPHRASE: ${{ secrets.GPG_TEST_PASSPHRASE }}
- name: Deploy release
if: github.event_name == 'push' && steps.version.outputs.is_snapshot != 'true' && startsWith(github.ref, 'refs/tags/')
run: mvn --batch-mode deploy
env:
CENTRAL_SONATYPE_USERNAME: ${{ secrets.CENTRAL_SONATYPE_USERNAME }}
CENTRAL_SONATYPE_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_PASSWORD }}
GPG_RELEASE_PASSPHRASE: ${{ secrets.GPG_RELEASE_PASSPHRASE }}
- name: Upload build artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: java-runtime-${{ github.event_name }}-${{ github.event.number || github.sha }}
path: target/*.jar
retention-days: 30
- name: Upload test results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always()
with:
name: test-results-${{ github.event_name }}-${{ github.event.number || github.sha }}
path: target/surefire-reports/
retention-days: 7