Publish to Maven Central#64
Conversation
|
It's been a while since I've dealt with the JVM in any way, but the fact that the recommended way to publish an artifact is through a community plugin instead of a simple official easy way is insane to me. In any case, thank you for your work ! |
Agreed, especially since Gradle is such a widely adopted system ... apparently at least there is an official Maven one. The PR is mostly complete now but I've kicked out the publishing to GitHub Packages which I'll add back in the next days. I've tried to summarize what I've learned in the PR description, is there anything unclear to you? |
Not really ! I've quickly read through the docs, and the PR. I'm just gonna create a new signing key and sonatype user token and add that to the repo's env. :) |
|
Great work, thank you for your help and guidance. I'm gonna fix some things like emails and the likes before merging, but you can consider it as done ! |
Updates publishing to Maven Central as described on this Kotlin documentation page. It uses the vanniktech/gradle-maven-publish-plugin publishing Gradle plugin. Also, the Gradle wrapper and Kotlin have been upgraded and deprecated build targets removed.
To publish to Maven Central, you need to
To publish using
.github/workflows.publish.yaml, add the following repository secrets:MAVEN_CENTRAL_USERNAMEMAVEN_CENTRAL_PASSWORDSIGNING_KEY_ID(GPG signing key ID)SIGNING_PASSWORD(password for GPG key)GPG_KEY_CONTENTS(entire contents of yourkey.gpgfile)GH_PACKAGES_USER(your GitHub username)GH_PACKAGES_TOKEN(your GitHub personal access tokens (classic) with package:write permission)The Gradle task will upload the release to Maven Central, but you still have to manually publish them on the portal. Once you do that, you cannot remove/change the published components. If you want a fully automated release, you can change the Gradle task from
publishToMavenCentraltopublishAndReleaseToMavenCentral.If you don't care for publishing to GitHub Packages, you can remove the
publishingsection on the bottom ofbuild.gradle.ktsand update thepublish.yamlpipeline,gradle.properties.yamlandREADME.mdaccordingly.