A Gradle plugin for signing artifacts with Sigstore.
Signature format uses Sigstore bundle JSON as the output format.
- Java 11
- Gradle 7.5
plugins {
id("dev.sigstore.sign") version "2.1.0"
}
// Automatically sign all Maven publications, using GitHub Actions OIDC when available,
// and browser based OIDC otherwise.For each file to be published an associated <filename>.sigstore.json signature file will be generated
In order for the required environment variables to be available, the workflow requires the following permissions:
permissions:
id-token: write
contents: readSee GitHub documentation for details.
plugins {
id("dev.sigstore.sign")
}
dependencies {
// Override sigstore-java clients, this may lead to unexpected behavior
sigstoreClient("dev.sigstore:sigstore-java:<alternate-version>")
}plugins {
id("dev.sigstore.sign")
}
// Default configuration signs Maven publicationsIf you want to avoid automatic signing, consider using dev.sigstore.sign-base plugin:
plugins {
id("dev.sigstore.sign-base")
}
// Configure SigstoreSignFilesTask tasks as you needplugins {
id("dev.sigstore.sign-base")
}
dev.sigstore.sign.tasks.SigstoreSignFilesTask
val helloProps by tasks.registering(WriteProperties::class) {
outputFile = file("build/helloProps.txt")
property("helloProps", "world")
}
val signHelloProps by tasks.registering(SigstoreSignFilesTask::class) {
// outputFile is File, so helloProps.map {..} is Provider<File>
signFile(helloProps.map { it.outputFile })
// Alternative APIs are
// sign(File)
// sign(Provider<RegularFile>)
}
val zip by tasks.registering(Zip::class) {
from(signHelloProps.map { it.singleSignature() })
}The signature uses Sigstore bundle JSON
stored as .sigstore.json file.
The file includes all the information for offline signature verification.
Automatically signs all Maven publications in Sigstore.
Provides SigstoreSignFilesTask task for signing files in Sigstore.
The plugin adds no tasks by default.
Properties:
dev.sigstore.sign.remove.sigstore.json.asc(since 0.6.0, default:true). Removes.sigstore.json.ascfiles from the publication. Sonatype OSSRH supports publishing.sigstore.jsonsignatures, and it does not require.sigstore.json.ascfiles, sodev.sigstore.signplugin removes them by default. If you need to sign all the files, set this property tofalse.
Extensions:
-
sigstoreSign:dev.sigstore.sign.SigstoreSignExtensionAn empty extension that may support configuration in the feature
Configurations:
-
sigstoreClientA configuration to declare the version for
sigstore-java. -
sigstoreClientClasspathA configuration that resolves
sigstore-javadependencies.
Tasks:
-
dev.sigstore.sign.SigstoreSignFilesTaskSigns entries via Sigstore.