Skip to content

chore: ignore checkstyle update in renovate due to JDK21 requirement #67

chore: ignore checkstyle update in renovate due to JDK21 requirement

chore: ignore checkstyle update in renovate due to JDK21 requirement #67

Workflow file for this run

name: publish
on:
push:
branches:
- main
workflow_dispatch:
inputs:
version:
description: 'Version number (e.g. 2.0.8) - leave empty to use branch/tag name'
required: false
type: string
default: ''
publish_maven:
description: 'Publish to Maven'
required: false
type: boolean
default: true
publish_javadoc:
description: 'Publish JavaDoc to gh-pages branch'
required: false
type: boolean
default: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# JavaDoc has not been published for a very long time.
publish-javadoc:
name: Publish Javadoc
runs-on: ubuntu-latest
timeout-minutes: 30
# Only publish when semantic-release creates a release commit (starts with "chore(release):")
if: (github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore(release):')) || (github.event_name == 'workflow_dispatch' && inputs.publish_javadoc)
permissions:
contents: write
pages: write
steps:
# Checkout the main and gh-pages branches. Main is used to generate the Javadoc, gh-pages stores the output Javadoc.
- name: Checkout main branch
uses: actions/checkout@v5
with:
path: main
persist-credentials: true
fetch-depth: 0
- name: Checkout gh-pages branch
uses: actions/checkout@v5
with:
fetch-depth: 0
path: gh-pages
persist-credentials: true
ref: gh-pages
- name: Set up Java 11
uses: actions/setup-java@v5
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'
- name: Determine version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.version }}" ]; then
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Publish Javadocs
env:
GITHUB_REPO_SLUG: ${{ github.repository }}
GITHUB_TAG: ${{ steps.version.outputs.version }}
run: |
main/build/publishJavadoc-gha.sh
publish-maven-central:
# Requires GPG_KEYNAME, GPG_PRIVATE_KEY, GPG_PASSPHRASE, CP_USERNAME, and CP_PASSWORD
name: Publish to Maven Central
runs-on: ubuntu-latest
timeout-minutes: 30
# Only publish when semantic-release creates a release commit (starts with "chore(release):")
if: (github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore(release):')) || (github.event_name == 'workflow_dispatch' && inputs.publish_maven)
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Java 11
uses: actions/setup-java@v5
with:
java-version: '11'
distribution: 'temurin'
cache: 'maven'
server-id: central
server-username: CP_USERNAME
server-password: CP_PASSWORD
# Import GPG key into build agent's local keystore
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Determine version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.version }}" ]; then
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Set Maven version
run: mvn versions:set -DnewVersion=${{ steps.version.outputs.version }} -DgenerateBackupPoms=false
- name: Deploy to Maven Central
env:
# Required variables and secrets for publishing to Maven Central
# GNU Privacy Guard variables
GPG_KEYNAME: ${{ vars.GPG_KEYNAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# Central portal username and password
CP_USERNAME: ${{ vars.CP_USERNAME }}
CP_PASSWORD: ${{ secrets.CP_PASSWORD }}
run: |
mvn -B -ntp deploy --settings build/.github.settings.xml -DskipTests -P central