Add automated Maven Central publishing via GitHub Actions - #1102
Open
jdiehl wants to merge 1 commit into
Open
Conversation
…e for Nexus publishing
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds automated publishing to Maven Central, replacing the current
manual/JitPack-only distribution with a fully automated CI/CD pipeline.
Addresses issue #634
Motivation
The project already has a
mavenpush.gradlewith Sonatype OSSRH configuration,but no automation around it. This PR wires everything up so that creating a
GitHub Release automatically builds, signs, and publishes to Maven Central —
no manual steps required.
It also migrates from the legacy
oss.sonatype.orgendpoint to the newSonatype Central Portal (
central.sonatype.com), which is the currentrecommended approach as OSSRH is being sunset.
Changes
New files
.github/workflows/ci.yml— builds and lints the:ucropmodule on everypush and pull request to
master/main.github/workflows/publish.yml— publishes to Maven Central automaticallywhen a GitHub Release is created
Modified files
build.gradle— adds thegradle-nexus/publish-plugin(v2.0.0), configured to target the new Central Portal OSSRH Staging API
endpoint; this enables fully automated staging close and release
mavenpush.gradle— three improvements:repositoriesblock (now managed by the nexus publish plugin)bundleReleaseAarwas declaredalongside
from components.release, which already includes it)local GPG keyring
Required setup (one-time, by repo maintainer)
Before the publish workflow can run, the following must be configured:
1. Register on Sonatype Central Portal
Sign in at https://central.sonatype.com and verify the
com.yalantisnamespaceis claimed under your account.
2. Generate a Portal Token
Go to Account → Generate User Token. This produces a new username/password pair
(distinct from old OSSRH credentials).
3. Add GitHub Repository Secrets
In Settings → Secrets and variables → Actions, add:
OSSRH_USERNAMEOSSRH_PASSWORDSIGNING_KEYgpg --armor --export-secret-keys YOUR_KEY_IDSIGNING_PASSWORDPublishing a release
v2.2.12)publishworkflow triggers automaticallyreleased to Maven Central without any manual intervention
Testing
The CI workflow (
ci.yml) runs on this PR to validate the build and lintchecks pass.