It's the barebones library project intended to quickly bootstrap a Kotlin Multiplatform library, that is deployable to Maven Central.
It has only one function: generate the Fibonacci sequence starting from platform-provided numbers. Also it has a test for each platform just to be sure that tests run.
Almost all links will work correctly in your own repository
-
- Clone this repository ot just use it as template
-
- Edit library module name and include it in
settings.gradle.kts
- Edit library module name and include it in
-
- Edit
groupId
andversion
- If you need the Android support update namespace there too
- If you don't need an Android support delete the
android
section
- Edit
At this stage you have everything setup to work with Kotlin Multiplatform the project should be buildable (but you might need to provide actual starting values for platforms you need).
To make it work on GitHub actions you need to update the matrix
section in gradle.yml
. If you didn't change platforms in build.gradle.kts
you don't need to touch anything. But still read it to understand how it works.
Also, currently it only runs tests, but you can change this behavior as you wish by modifying matrix
and the Gradle build command
The most part of the job is already automated for you. However, deployment to Maven Central requires some manual work from your side.
-
- Create an account at Sonatype issue tracker
-
- Create an issue to create new project for you
-
- You will have to prove that you own your desired namespace
-
- Create a GPG key with
gpg --gen-key
, use the same email address you used to sign up to the Sonatype Jira
- Create a GPG key with
-
- Find your key id in output of the previous command looking like
<your key id>
- Find your key id in output of the previous command looking like
-
- Upload your key to a keyserver, for example
gpg --send-keys --keyserver keyserver.ubuntu.com "<your key id>"
-
- Now you should create secrets available to your GitHub Actions
- via
gh
command
gh secret set OSSRH_GPG_SECRET_KEY -a actions --body "$(gpg --export --armor "<your key id>")" gh secret set OSSRH_GPG_SECRET_KEY_ID -a actions --body "<your key id>" gh secret set OSSRH_GPG_SECRET_KEY_PASSWORD -a actions --body "<your key password>" gh secret set OSSRH_PASSWORD -a actions --body "<your sonatype account password>" gh secret set OSSRH_USERNAME -a actions --body "<your sonatype account username>"
- Or via interface in
Settings
→Secrets and Variables
→Actions
same variables as in 1.
-
- Edit deployment pom parameters in
module.publication.gradle.kts
- Edit deployment pom parameters in
-
- Edit deploy targets in
deploy.yml
- Edit deploy targets in
-
- Call deployment manually when ready in Actions →
Run Workflow
- Call deployment manually when ready in Actions →
-
- When you see in your account on https://oss.sonatype.org that everything is fine you can release your staging repositories and add target
releaseSonatypeStagingRepository
todeploy.yml
after this line. This way artifacts will be published to central automatically when tests pass.
- When you see in your account on https://oss.sonatype.org that everything is fine you can release your staging repositories and add target