A GitHub action to automate the following:
- Gradle checks
- Publication to Sonatype (usually OSSRH, so it gets released to Maven Central)
- Change log generation (and commit) relying on the GitHub Changelog Gradle Plugin
- GitHub release creation (with the change log contents)
- The project must be a Gradle project
- It must apply the GitHub Changelog Gradle Plugin, configured with the
futureReleaseVersion
set to the current project version - It must apply the Gradle Nexus Publish Plugin, configured to publish to a Sonatype Nexus repository (usually OSSRH for publications to Maven Central)
- It must apply the Signing Plugin, configured with ASCII-armored in-memory GPG keys
Here is an example workflow built with this action:
name: release
on:
workflow_dispatch:
inputs:
version:
description: "New version"
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Release
uses: joffrey-bion/gradle-library-release-action@v2
with:
version: ${{ inputs.version }}
gpg-signing-key: ${{ secrets.GPG_SECRET_ASCII_ARMORED }}
gpg-signing-password: ${{ secrets.GPG_PASSWORD }}
sonatype-username: ${{ secrets.OSSRH_USER_TOKEN }}
sonatype-password: ${{ secrets.OSSRH_KEY }}