|
| 1 | +import java.util.Base64 |
| 2 | + |
1 | 3 | plugins { |
2 | 4 | id("org.gradle.maven-publish") |
| 5 | + id("signing") |
3 | 6 | } |
4 | 7 |
|
5 | | -publishing { |
6 | | - group = "dev.icerock.moko" |
7 | | - version = Deps.mokoJavascriptVersion |
| 8 | +group = "dev.icerock.moko" |
| 9 | +version = Deps.mokoJavascriptVersion |
| 10 | + |
| 11 | +val javadocJar by tasks.registering(Jar::class) { |
| 12 | + archiveClassifier.set("javadoc") |
| 13 | +} |
8 | 14 |
|
9 | | - repositories.maven("https://api.bintray.com/maven/icerockdev/moko/moko-javascript/;publish=1") { |
10 | | - name = "bintray" |
| 15 | +publishing { |
| 16 | + repositories.maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { |
| 17 | + name = "OSSRH" |
11 | 18 |
|
12 | 19 | credentials { |
13 | | - username = System.getenv("BINTRAY_USER") |
14 | | - password = System.getenv("BINTRAY_KEY") |
| 20 | + username = System.getenv("OSSRH_USER") |
| 21 | + password = System.getenv("OSSRH_KEY") |
| 22 | + } |
| 23 | + } |
| 24 | + |
| 25 | + publications.withType<MavenPublication> { |
| 26 | + // Stub javadoc.jar artifact |
| 27 | + artifact(javadocJar.get()) |
| 28 | + |
| 29 | + // Provide artifacts information requited by Maven Central |
| 30 | + pom { |
| 31 | + name.set("MOKO JavaScript") |
| 32 | + description.set("JavaScript code evaluation from common code for Kotlin Multiplatform Mobile") |
| 33 | + url.set("https://github.com/icerockdev/moko-javascript") |
| 34 | + licenses { |
| 35 | + license { |
| 36 | + name.set("Apache-2.0") |
| 37 | + distribution.set("repo") |
| 38 | + url.set("https://github.com/icerockdev/moko-javascript/blob/master/LICENSE.md") |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + developers { |
| 43 | + developer { |
| 44 | + id.set("Tetraquark") |
| 45 | + name.set("Vladislav Areshkin") |
| 46 | + |
| 47 | + } |
| 48 | + developer { |
| 49 | + id.set("Dorofeev") |
| 50 | + name.set("Andrey Dorofeev") |
| 51 | + |
| 52 | + } |
| 53 | + developer { |
| 54 | + id.set("Alex009") |
| 55 | + name.set("Aleksey Mikhailov") |
| 56 | + |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + scm { |
| 61 | + connection.set("scm:git:ssh://github.com/icerockdev/moko-javascript.git") |
| 62 | + developerConnection.set("scm:git:ssh://github.com/icerockdev/moko-javascript.git") |
| 63 | + url.set("https://github.com/icerockdev/moko-javascript") |
| 64 | + } |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | + signing { |
| 69 | + val signingKeyId: String? = System.getenv("SIGNING_KEY_ID") |
| 70 | + val signingPassword: String? = System.getenv("SIGNING_PASSWORD") |
| 71 | + val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key -> |
| 72 | + String(Base64.getDecoder().decode(base64Key)) |
| 73 | + } |
| 74 | + if (signingKeyId != null) { |
| 75 | + useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) |
| 76 | + sign(publishing.publications) |
15 | 77 | } |
16 | 78 | } |
17 | 79 | } |
0 commit comments