This document describes how to release artifacts to Maven Central.
Configure these GitHub secrets in Settings → Secrets and variables → Actions:
CENTRAL_TOKEN_USERNAME- Maven Central token usernameCENTRAL_TOKEN_PASSWORD- Maven Central token passwordGPG_SIGNING_KEY- GPG private key (full armored block)GPG_SIGNING_KEY_PASSWORD- GPG key passphrase
Actions → Release to Maven Central → Run workflow
No version input is required. The workflow derives the release version from the current POM by stripping the -SNAPSHOT suffix (e.g., 0.5.0-SNAPSHOT → release 0.5.0). The main branch must always be on a -SNAPSHOT version.
- Derives the release version from the current POM snapshot version (strips
-SNAPSHOT) - Updates POM versions to the release version in all modules (core, processor, example, example-custom-generator)
- Commits the version bump on a dedicated
release/vX.Y.Zbranch and creates tagvX.Y.Z - Builds and verifies the project with
-Prelease(reproducible builds viaproject.build.outputTimestamp) - Signs artifacts with GPG
- Generates a CycloneDX SBOM (JSON + XML) for each published module
- Runs tests and stages the deployment to the Sonatype Central portal (does not auto-publish)
- Creates a build-provenance attestation for the published jars
- Bumps all module versions to the next snapshot (e.g.,
0.6.0-SNAPSHOTafter releasing0.5.0) and commits it as a second commit on the release branch - Pushes the release branch and tag (never pushes directly to
main) - Opens a pull request against
maincontaining both the release version commit and the next-snapshot bump - Creates draft GitHub release (jars, sources, javadoc and SBOMs attached; requires manual publish)
- Publish to Maven Central: Go to the Sonatype Central portal, review the staged deployment, and manually publish it. Nothing is released to consumers until this step is performed.
- Publish GitHub Release: Go to Releases → Edit draft → Publish release
- Verify Maven Central: Artifacts appear at https://central.sonatype.com/ (15-30 min delay)
- Search for:
io.github.java-helpers:simple-builders-coreorsimple-builders-processor
- Search for:
- Test the release:
<dependency> <groupId>io.github.java-helpers</groupId> <artifactId>simple-builders-core</artifactId> <version>0.5.0</version> </dependency>
- Merge the version-bump pull request: Review and merge the PR opened by the workflow. This updates
mainwith both the release version commit (taggedvX.Y.Z) and the next-snapshot bump (e.g.,0.6.0-SNAPSHOT), so development can continue.
For manual local releases without GitHub Actions:
# Stage artifacts (requires manual publishing in Sonatype portal)
mvn clean deploy -Prelease
# Stage and auto-publish
mvn clean deploy -Prelease -Dcentral.autoPublish=trueNote: You need configured GPG keys and Maven Central credentials in ~/.m2/settings.xml
- GPG errors: Verify
GPG_SIGNING_KEYis complete (includes-----BEGIN/END PGP PRIVATE KEY BLOCK-----) - Auth errors: Check
CENTRAL_TOKEN_USERNAMEandCENTRAL_TOKEN_PASSWORD - Version conflicts: Maven Central versions are immutable; increment and re-release
- Workflow fails on push: Ensure GitHub Actions has write permissions (Settings → Actions → General → Workflow permissions)
Each release produces, in addition to the GPG-signed jars:
- SBOM (CycloneDX
*-sbom.json/*-sbom.xml) per module, attached to the GitHub release, so consumers can inventory/scan transitive dependencies. - Build provenance attestation (
actions/attest-build-provenance) for the jars, verifiable withgh attestation verify <jar> --repo java-helpers/simple-builders. - Reproducible builds:
project.build.outputTimestampis set so archive entries are deterministic. The release workflow updates it automatically; it can be overridden per build with-Dproject.build.outputTimestamp=<commit ISO-8601 date>.
- Project uses Semantic Versioning (MAJOR.MINOR.PATCH)
- The
mainbranch must always be on a-SNAPSHOTversion; the release version is derived automatically - After each release, all modules are bumped to the next minor snapshot (e.g.,
0.5.0→0.6.0-SNAPSHOT) - Versions with
-(e.g.,0.2.0-beta) are marked as pre-releases - Releases are staged to the Sonatype Central portal and require a manual publish step; nothing is auto-released
- Only
coreandprocessormodules are published to Maven Central - The
exampleandexample-custom-generatormodules are version-updated alongside the released modules but are not deployed to Maven Central