|
1 | 1 | /* |
2 | | - * Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. |
| 2 | + * Copyright 2025 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. |
3 | 3 | */ |
4 | 4 |
|
5 | 5 | import java.util.Base64 |
6 | 6 |
|
7 | 7 | plugins { |
8 | | - id("javadoc-stub-convention") |
9 | 8 | id("org.gradle.maven-publish") |
10 | | - id("signing") |
11 | 9 | } |
12 | 10 |
|
13 | 11 | publishing { |
14 | | - repositories.maven("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { |
15 | | - name = "OSSRH" |
16 | | - |
17 | | - credentials { |
18 | | - username = System.getenv("OSSRH_USER") |
19 | | - password = System.getenv("OSSRH_KEY") |
20 | | - } |
21 | | - } |
22 | | - |
23 | 12 | publications.withType<MavenPublication> { |
24 | 13 | // Provide artifacts information requited by Maven Central |
25 | 14 | pom { |
@@ -61,15 +50,22 @@ publishing { |
61 | 50 | } |
62 | 51 | } |
63 | 52 |
|
| 53 | +val signingKeyId: String? = System.getenv("SIGNING_KEY_ID") |
| 54 | +if (signingKeyId != null) { |
| 55 | + apply(plugin = "signing") |
| 56 | + |
| 57 | + configure<SigningExtension> { |
| 58 | + val signingPassword: String? = System.getenv("SIGNING_PASSWORD") |
| 59 | + val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key -> |
| 60 | + String(Base64.getDecoder().decode(base64Key)) |
| 61 | + } |
64 | 62 |
|
65 | | -signing { |
66 | | - val signingKeyId: String? = System.getenv("SIGNING_KEY_ID") |
67 | | - val signingPassword: String? = System.getenv("SIGNING_PASSWORD") |
68 | | - val signingKey: String? = System.getenv("SIGNING_KEY")?.let { base64Key -> |
69 | | - String(Base64.getDecoder().decode(base64Key)) |
70 | | - } |
71 | | - if (signingKeyId != null) { |
72 | 63 | useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) |
73 | 64 | sign(publishing.publications) |
74 | 65 | } |
| 66 | + |
| 67 | + val signingTasks = tasks.withType<Sign>() |
| 68 | + tasks.withType<AbstractPublishToMaven>().configureEach { |
| 69 | + dependsOn(signingTasks) |
| 70 | + } |
75 | 71 | } |
0 commit comments