Skip to content

Releasing to Maven Central

Tomasz Kalkosiński edited this page Jan 29, 2021 · 4 revisions

Releasing artifacts to Maven Central

Creating a key pair for signing

Follow the "Generate a key pair" and "Distributing your public key" sections on this page: http://central.sonatype.org/pages/working-with-pgp-signatures.html

If you have problems with GPG 2.1 or later and issue https://github.com/gradle/gradle/issues/888 is not yet fixed use:

gpg --export-secret-keys >~/.gnupg/secring.gpg

Release with GitHub Actions

You can build and release to OSSHR with GitHub Actions. Just create a new tag with format sputnik-1.2.3 to trigger a Workflow Action. It will build an artifact, sign it, upload to OSSHR and create GitHub Release draft with assets. Then you need to manually go to Sonatype (read below) and manually review Release draft and publish it.

Setup local environment

There is gradle.properties file in project's dir. It contains signing settings. You can safely override those with a custom file in ~/.gradle/gradle.properties, which should have entries such as:

signing.keyId=1A6165361333                                              `
signing.password=password1
signing.secretKeyRingFile=/home/dir/.gnupg/secring.gpg

sonatypeUsername=joe_barr
sonatypePassword=password2

Releasing with axion

git tag
./gradlew currentVersion
./gradlew markNextVersion -Prelease.version=1.8.0
git tag
./gradlew currentVersion
./gradlew release

Uploading

$ gradle uploadArchives

Completing the release

TODO - this need to have appropriate screenshots.

If you go here: https://oss.sonatype.org/#stagingRepositories You will see your staging repository in the "open" state. It will not be a part of the public group until you select the Staging Repository and click the "Close" button. Your artifacts will not sync to Central until they are released. So, after you've clicked the "Close" button and (if necessary) done any further testing, you need to select the Staging Repository again, to click the "Release" button. Once you've successfully released, please comment again on this issue, and I can activate the sync to Central.