added workflow to publish to maven central#102
Conversation
|
|
@xgp great, thanks for this contribution! 🚀 @anttileppa could you please help us set this up as the steps explained above? 🙏 |
|
HI @anttileppa |
|
In case the Maven Central stuff is too heavy of a lift, I already started publishing it under our groupId ( https://central.sonatype.com/artifact/io.phasetwo.keycloak/keycloak-scim-server It uses this action to publish a dot release for every push to If you'd prefer, you can just direct people to use it from maven like this: <dependency>
<groupId>io.phasetwo.keycloak</groupId>
<artifactId>keycloak-scim-server</artifactId>
<version>1.5.0.4</version>
</dependency> |



Maven Central Publishing Setup
Fixes #21
Adds a GitHub Actions workflow and Gradle config to publish the jar to Maven Central via the new Central Portal (OSSRH was retired on 2025-06-30).
Files changed
build.gradle.kts— added thecom.vanniktech.maven.publishplugin (v0.30.0), full POM metadata, conditional in-memory PGP signing, and Central Portal config..github/workflows/publish-maven-central.yaml— new workflow that triggers onrelease: published(andworkflow_dispatch), runs./gradlew publishAndReleaseToMavenCentralto bundle the staging dir and upload it through the Central Portal API with auto-release.Key design choices
com.vanniktech.maven.publish— Sonatype still has no official Gradle plugin for the Central Portal, and this is the most widely used community plugin.SonatypeHost.CENTRAL_PORTAL+automaticRelease = trueso deployments don't sit pending manual approval at central.sonatype.com.master-publish-docker-image.yamlworkflow (which runs the broader./gradlew publish) from failing when GPG keys aren't available. Verified via--dry-runthat the existing workflow still works (Maven Central tasks just write to a local staging dir without creds).--no-configuration-cacheon the publish step since the project has config cache enabled globally and signing tasks don't always play well with it.Required GitHub Actions secrets
MAVEN_CENTRAL_USERNAMEMAVEN_CENTRAL_PASSWORDMAVEN_GPG_PRIVATE_KEYgpg --export-secret-keys --armor <KEY_ID>— paste the entire-----BEGIN PGP PRIVATE KEY BLOCK-----blockMAVEN_GPG_KEY_IDgpg --list-secret-keys --keyid-format=shortMAVEN_GPG_PASSPHRASEGITHUB_TOKENis auto-provided.One-time prerequisites outside the repo
fi.metatavu.keycloak.scim.serverrequires control offi.metatavu.master-publish-docker-image.yaml), this workflow fires automatically and uses the tag (with leading v stripped) as the version. Manual runs are also supported via workflow_dispatch.