Skip to content

Commit 89f25dd

Browse files
authored
Prepare MavenCentral Release (#79)
Co-authored-by: hfhbd <[email protected]>
1 parent 701dbfc commit 89f25dd

File tree

4 files changed

+71
-31
lines changed

4 files changed

+71
-31
lines changed

.github/workflows/CD.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ jobs:
2020
- name: Build all modules with Gradle
2121
run: ./gradlew build
2222
- name: Publish
23-
run: ./gradlew -Pversion=$version publish
23+
run: ./gradlew -Pversion=$version -Dorg.gradle.parallel=false publish closeAndReleaseStagingRepository
2424
env:
25-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
SIGNING_PRIVATE_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }}
26+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
27+
SONARTYPE_APIKEY: ${{ secrets.SONARTYPE_APIKEY }}
28+
SONARTYPE_APITOKEN: ${{ secrets.SONARTYPE_APITOKEN }}

build.gradle.kts

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
plugins {
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

69
group = "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+
email.set("[email protected]")
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
}

cloudkitclient-core/build.gradle.kts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ plugins {
33
kotlin("plugin.serialization")
44
id("org.jetbrains.dokka") version "1.5.0"
55
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.6.0"
6-
`maven-publish`
76
}
87

98
kotlin {
@@ -33,16 +32,3 @@ kotlin {
3332
}
3433
}
3534
}
36-
37-
publishing {
38-
repositories {
39-
maven {
40-
name = "GitHubPackages"
41-
url = uri("https://maven.pkg.github.com/hfhbd/cloudkitclient")
42-
credentials {
43-
username = System.getenv("GITHUB_ACTOR")
44-
password = System.getenv("GITHUB_TOKEN")
45-
}
46-
}
47-
}
48-
}

cloudkitclient-testing/build.gradle.kts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ plugins {
33
kotlin("plugin.serialization")
44
id("org.jetbrains.dokka") version "1.5.0"
55
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.6.0"
6-
`maven-publish`
76
}
87

98
kotlin {
@@ -25,16 +24,3 @@ kotlin {
2524
}
2625
}
2726
}
28-
29-
publishing {
30-
repositories {
31-
maven {
32-
name = "GitHubPackages"
33-
url = uri("https://maven.pkg.github.com/hfhbd/cloudkitclient")
34-
credentials {
35-
username = System.getenv("GITHUB_ACTOR")
36-
password = System.getenv("GITHUB_TOKEN")
37-
}
38-
}
39-
}
40-
}

0 commit comments

Comments
 (0)