Skip to content

Commit 6687ba5

Browse files
authored
Sign artifacts when publishing. (#22)
1 parent 56a7c18 commit 6687ba5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ allprojects {
128128
}
129129

130130
plugins.withId("maven-publish") {
131+
plugins.apply("signing")
132+
131133
val publishTask = tasks.named("publish")
132134

133135
postReleaseTask.configure {
@@ -194,6 +196,17 @@ allprojects {
194196
}
195197
}
196198
}
199+
200+
tasks.withType<Sign>().configureEach {
201+
onlyIf { System.getenv("CI") == "true" }
202+
}
203+
204+
configure<SigningExtension> {
205+
val signingKey = System.getenv("GPG_PRIVATE_KEY")
206+
val signingPassword = System.getenv("GPG_PASSPHRASE")
207+
useInMemoryPgpKeys(signingKey, signingPassword)
208+
sign(the<PublishingExtension>().publications["maven"])
209+
}
197210
}
198211
}
199212

0 commit comments

Comments
 (0)