# Building Kotlin/Multiplatform with Github Actions

DevFeed: [Building Kotlin/Multiplatform with Github Actions](<https://devfeed.tech/articles/building-kotlin-multiplatform-with-github-actions-22859.md>)

Original publisher: [Read original article](<https://medium.com/kodein-koders/building-kotlin-multiplatform-with-github-actions-2478801d6d46?source=rss----f311f45ef54---4>)

Author: Romain Boisselle

Published: 2021-04-15T11:44:49Z

Content type: tutorial

Language: en

Sources: [Kodein Koders - Medium](<https://devfeed.tech/sources/kodein-koders-medium.md>)

Topics: [GitHub Actions](<https://devfeed.tech/topics/github-actions.md>), [Kotlin Multiplatform](<https://devfeed.tech/topics/kotlin-multiplatform.md>), [CI/CD](<https://devfeed.tech/topics/cicd.md>), [kotlin-multiplatform-libraries](<https://devfeed.tech/topics/kotlin-multiplatform-libraries.md>), [Maven Central](<https://devfeed.tech/topics/maven-central.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [HTTP](<https://devfeed.tech/topics/http.md>), [API](<https://devfeed.tech/topics/api.md>)

Tags: [ci-cd](<https://devfeed.tech/tags/ci-cd.md>), [github](<https://devfeed.tech/tags/github.md>), [github-actions](<https://devfeed.tech/tags/github-actions.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [http](<https://devfeed.tech/tags/http.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [kotlin-multiplatform-libraries](<https://devfeed.tech/tags/kotlin-multiplatform-libraries.md>), [maven-central](<https://devfeed.tech/tags/maven-central.md>)

## AI overview

This tutorial explains how to automate Kotlin Multiplatform library publishing with GitHub Actions. It covers publishing snapshots to Maven Central, building across Linux, macOS, and Windows, and managing a shared Sonatype staging repository for stable releases.

## Source excerpt

In a previous tutorial, I showed you how to configure your Kotlin/Multiplatform libraries to be published on Maven Central. To go beyond a publication process we now need to automate things with a good CI/CD workflow. Let's see how to do this with Github Actions. As the Kodein Open Source Initiative libraries are hosted on Github, we felt that it was the best choice to use the Github Actions pipelines to test, build and deploy our libraries, as it is entirely integrated with every other part of Github. Let's start with the snapshot publication process, as it is fairly straightforward. Publishing snapshots on Maven Central has no more constraints than just being authenticated with your Sonatype account, and having your artifacts file names ending with the uppercased word SNAPSHOT. This means that you could literally upload anything in your staging repositories. Here is a Github Actions script to upload a snapshot of a Kotlin/Multiplatform project: https://medium.com/media/41c7ac097f1ff802076f92acc8243077/href In that example, we run the task publishAllPublicationToOss on Linux, Mac & Windows, literally saying to publish every available targets onto the oss repository, which is the name we gave to it in our maven-publish configuration in our Gradle build script. This is not optimal, as every platform could upload shared targets like JVM, JS or even the Kotlin Multiplatform Metadata, but it's simple, and it works! Let's now see how to deploy stable releases. We have to discuss how we will be managing the unique staging repository we need. In fact, this is quite simple, and it is resume by this image: What we need is to create a staging repository, by using the sonatype API over HTTP. This step will generate a repository ID, that we use in later steps. In the build-upload matrix, we upload every artifact onto the same staging repository. Finally, In the drop-or-release job, depending on the success or failure of the build-upload matrix, we drop or release the staging re