Skip to content

Commit

Permalink
gpg and sigstore sign publications
Browse files Browse the repository at this point in the history
Signed-off-by: Appu Goundan <[email protected]>
  • Loading branch information
loosebazooka committed Jan 8, 2024
1 parent 5f17fc9 commit 4c98368
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 30 deletions.
1 change: 1 addition & 0 deletions build-logic/publishing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ dependencies {
implementation(project(":basics"))
implementation(project(":jvm"))
implementation("dev.sigstore.build-logic:gradle-plugin")
implementation("dev.sigstore:sigstore-gradle-sign-plugin:0.5.0")
implementation("com.gradle.plugin-publish:com.gradle.plugin-publish.gradle.plugin:1.2.1")
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id("build-logic.java-library")
id("build-logic.reproducible-builds")
id("build-logic.publish-to-central")
id("build-logic.signing")
}

java {
Expand All @@ -17,3 +18,5 @@ publishing {
}
}
}

signing.sign(publishing.publications["mavenJava"])
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
plugins {
id("signing")
id("dev.sigstore.sign")
}

signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
}

tasks.withType<Sign>().configureEach {
onlyIf("Is a release") {
project.hasProperty("release")
}
onlyIf("Signing is not skipped") {
!project.hasProperty("skipSigning")
}
onlyIf("PGP Signing is not skipped") {
!project.hasProperty("skipPgpSigning")
}
}

tasks.withType<dev.sigstore.sign.tasks.SigstoreSignFilesTask>().configureEach {
onlyIf("Is a release") {
project.hasProperty("release")
}
onlyIf("Signing is not skipped") {
!project.hasProperty("skipSigning")
}
onlyIf("Sigstore Signing is not skipped") {
!project.hasProperty("skipSigstoreSigning")
}
}
30 changes: 0 additions & 30 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,35 +1,5 @@
plugins {
id("build-logic.root-build")
// It does not support participating in precompiled script plugins
id("com.github.vlsi.stage-vote-release") version "1.90"
// The Kotlin Gradle plugin was loaded multiple times in different subprojects, which is not supported and may break the build.
`embedded-kotlin` apply false
}

version = "${findProperty("version")}${releaseParams.snapshotSuffix}"

println("Building Sigstore Java $version")

releaseParams {
tlp.set("sigstore-java")
organizationName.set("sigstore")
componentName.set("sigstore-java")
prefixForProperties.set("s01")
svnDistEnabled.set(false)
sitePreviewEnabled.set(false)
nexus {
prodUrl.set(uri("https://s01.oss.sonatype.org"))
}
voteText.set {
"""
${it.componentName} v${it.version}-rc${it.rc} is ready for preview.
Git SHA: ${it.gitSha}
Staging repository: ${it.nexusRepositoryUri}
""".trimIndent()
}
}

allprojects {
version = rootProject.version
}

0 comments on commit 4c98368

Please sign in to comment.