Skip to content

Commit 38e59f4

Browse files
authored
Merge pull request #602 from sigstore/setup-signing
gpg and sigstore sign publications
2 parents b1d5e99 + e7e41a7 commit 38e59f4

File tree

4 files changed

+40
-26
lines changed

4 files changed

+40
-26
lines changed

build-logic/publishing/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ dependencies {
1010
implementation(project(":basics"))
1111
implementation(project(":jvm"))
1212
implementation("dev.sigstore.build-logic:gradle-plugin")
13+
implementation("dev.sigstore:sigstore-gradle-sign-plugin:0.5.0")
1314
implementation("com.gradle.plugin-publish:com.gradle.plugin-publish.gradle.plugin:1.2.1")
1415
}

build-logic/publishing/src/main/kotlin/build-logic.java-published-library.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
id("build-logic.java-library")
44
id("build-logic.reproducible-builds")
55
id("build-logic.publish-to-central")
6+
id("build-logic.signing")
67
}
78

89
java {
@@ -17,3 +18,5 @@ publishing {
1718
}
1819
}
1920
}
21+
22+
signing.sign(publishing.publications["mavenJava"])
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
plugins {
2+
id("signing")
3+
id("dev.sigstore.sign")
4+
}
5+
6+
signing {
7+
val signingKey: String? by project
8+
val signingPassword: String? by project
9+
useInMemoryPgpKeys(signingKey, signingPassword)
10+
}
11+
12+
tasks.withType<Sign>().configureEach {
13+
onlyIf("Is a release") {
14+
project.hasProperty("release")
15+
}
16+
onlyIf("Signing is not skipped") {
17+
!project.hasProperty("skipSigning")
18+
}
19+
onlyIf("PGP Signing is not skipped") {
20+
!project.hasProperty("skipPgpSigning")
21+
}
22+
}
23+
24+
tasks.withType<dev.sigstore.sign.tasks.SigstoreSignFilesTask>().configureEach {
25+
onlyIf("Is a release") {
26+
project.hasProperty("release")
27+
}
28+
onlyIf("Signing is not skipped") {
29+
!project.hasProperty("skipSigning")
30+
}
31+
onlyIf("Sigstore Signing is not skipped") {
32+
!project.hasProperty("skipSigstoreSigning")
33+
}
34+
}

build.gradle.kts

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,11 @@
11
plugins {
22
id("build-logic.root-build")
3-
// It does not support participating in precompiled script plugins
4-
id("com.github.vlsi.stage-vote-release") version "1.90"
53
// The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build.
64
`embedded-kotlin` apply false
75
}
86

9-
version = "${findProperty("version")}${releaseParams.snapshotSuffix}"
10-
11-
println("Building Sigstore Java $version")
12-
13-
releaseParams {
14-
tlp.set("sigstore-java")
15-
organizationName.set("sigstore")
16-
componentName.set("sigstore-java")
17-
prefixForProperties.set("s01")
18-
svnDistEnabled.set(false)
19-
sitePreviewEnabled.set(false)
20-
nexus {
21-
prodUrl.set(uri("https://s01.oss.sonatype.org"))
22-
}
23-
voteText.set {
24-
"""
25-
${it.componentName} v${it.version}-rc${it.rc} is ready for preview.
26-
27-
Git SHA: ${it.gitSha}
28-
Staging repository: ${it.nexusRepositoryUri}
29-
""".trimIndent()
30-
}
31-
}
7+
val calculatedVersion = property("version") as String + (if (hasProperty("release")) "" else "-SNAPSHOT")
328

339
allprojects {
34-
version = rootProject.version
10+
version = calculatedVersion
3511
}

0 commit comments

Comments
 (0)