11plugins {
22 kotlin(" multiplatform" ) version " 1.5.21" apply false
33 kotlin(" plugin.serialization" ) version " 1.5.21" apply false
4+ `maven- publish`
5+ signing
6+ id(" io.github.gradle-nexus.publish-plugin" ) version " 1.1.0"
47}
58
69group = " app.softwork"
@@ -9,10 +12,72 @@ repositories {
912 mavenCentral()
1013}
1114
12- subprojects {
15+ nexusPublishing {
16+ repositories {
17+ sonatype {
18+ username.set(System .getProperty(" sonartype.apiKey" ) ? : System .getenv(" SONARTYPE_APIKEY" ))
19+ password.set(System .getProperty(" sonartype.apiToken" ) ? : System .getenv(" SONARTYPE_APITOKEN" ))
20+ nexusUrl.set(uri(" https://s01.oss.sonatype.org/service/local/" ))
21+ snapshotRepositoryUrl.set(uri(" https://s01.oss.sonatype.org/content/repositories/snapshots/" ))
22+ }
23+ }
24+ }
25+
26+ allprojects {
27+ apply (plugin = " org.gradle.maven-publish" )
28+ apply (plugin = " org.gradle.signing" )
29+
1330 group = " app.softwork"
1431
1532 repositories {
1633 mavenCentral()
1734 }
35+
36+ group = " app.softwork"
37+
38+ task(" emptyJar" , Jar ::class ) {
39+ }
40+
41+ publishing {
42+ publications.all {
43+ if (this is MavenPublication ) {
44+ artifact(tasks.getByName(" emptyJar" )) {
45+ classifier = " javadoc"
46+ }
47+ pom {
48+ name.set(" app.softwork CloudKit Client Library" )
49+ description.set(" A multiplatform Kotlin library to use Apple CloudKit" )
50+ url.set(" https://github.com/hfhbd/CloudKitClient" )
51+ licenses {
52+ license {
53+ name.set(" The Apache License, Version 2.0" )
54+ url.set(" https://www.apache.org/licenses/LICENSE-2.0.txt" )
55+ }
56+ }
57+ developers {
58+ developer {
59+ id.set(" hfhbd" )
60+ name.set(" Philip Wedemann" )
61+ 62+ }
63+ }
64+ scm {
65+ connection.set(" scm:git://github.com/hfhbd/CloudKitClient.git" )
66+ developerConnection.set(" scm:git://github.com/hfhbd/CloudKitClient.git" )
67+ url.set(" https://github.com/hfhbd/CloudKitClient" )
68+ }
69+ }
70+ }
71+ }
72+ }
73+ (System .getProperty(" signing.privateKey" ) ? : System .getenv(" SIGNING_PRIVATE_KEY" ))?.let {
74+ String (java.util.Base64 .getDecoder().decode(it)).trim()
75+ }?.let { key ->
76+ println (" found key, config signing" )
77+ signing {
78+ val signingPassword = System .getProperty(" signing.password" ) ? : System .getenv(" SIGNING_PASSWORD" )
79+ useInMemoryPgpKeys(key, signingPassword)
80+ sign(publishing.publications)
81+ }
82+ }
1883}
0 commit comments