/kmp-template-library

Cross-platform library template with base configuration to publish.

Primary LanguageRuby

KMP Template Library

Cross-platform library template with base configuration to publish it in maven central.

Registering a Sonatype account

If this is your first library, or you’ve only ever used Bintray to do this before, you will need to first register a Sonatype account.

There are many articles describing the registration process on the internet. The one from GetStream is exhaustive and up to date. You can start by following the first four steps, including "Generating a GPG key pair":

  • Register a Jira account with Sonatype (you can use my issue as an example). ✅
  • Verify your ownership of the group ID you want to use to publish your artifact by creating a GitHub repo. ✅
  • Generate a GPG key pair for signing your artifacts. ✅
  • Publish your public key. ✅
  • Export your private key. ✅

When the Maven repository and signing keys for your library are prepared, we are ready to move forward and set up our build to upload the library artifacts to a staging repository and then release them!

Publishing multiplatform libraries

You can publish a multiplatform library to a local Maven repository with the maven-publish Gradle plugin. Specify the group, version, and the repositories where the library should be published. The plugin creates publications automatically.

Official documentation: https://kotlinlang.org/docs/multiplatform-publish-lib.html

Settings

Create this variable on local.properties file:

signing.keyId={your key id}
signing.password={your key password}
signing.key={your key on base64}
ossrhUsername={oss username}
ossrhPassword={oss password}

Github actions

Configure this variable on actions secrets file:

KEY_ID:
GPG_PRIVATE_KEY: 
GPG_PRIVATE_PASSWORD:
SONATYPE_USERNAME
SONATYPE_PASSWORD:

References