Merge branch 'gpg'

This commit is contained in:
crschnick 2024-03-21 04:48:05 +00:00
parent e1002cf60f
commit bced7bdc33
3 changed files with 23 additions and 7 deletions

View file

@ -97,6 +97,12 @@ project.ext {
file("$rootDir/dist/changelogs/${versionString}.md") : file("$rootDir/dist/changelogs/${versionString}.md") :
file("$rootDir/dist/changelogs/${canonicalVersionString}.md") file("$rootDir/dist/changelogs/${canonicalVersionString}.md")
incrementalChangelogFile = file("$rootDir/dist/changelogs/${canonicalVersionString}_incremental.md") incrementalChangelogFile = file("$rootDir/dist/changelogs/${canonicalVersionString}_incremental.md")
signingKeyId = project.hasProperty('signingKeyId') ? project.property("signingKeyId") : System.getenv('GPG_KEY_ID')
signingKey = project.hasProperty('signingKeyFile') ? file(project.property("signingKeyFile")).text : System.getenv('GPG_KEY')
signingPassword = project.hasProperty('signingKeyPassword') ? project.property("signingKeyPassword") : System.getenv('GPG_KEY_PASSWORD')
if (signingPassword == null) {
signingPassword = ''
}
} }
if (org.gradle.internal.os.OperatingSystem.current() == org.gradle.internal.os.OperatingSystem.LINUX) { if (org.gradle.internal.os.OperatingSystem.current() == org.gradle.internal.os.OperatingSystem.LINUX) {

17
dist/build.gradle vendored
View file

@ -5,6 +5,7 @@ plugins {
id 'org.jreleaser' version '1.8.0' id 'org.jreleaser' version '1.8.0'
id("com.netflix.nebula.ospackage") version "11.4.0" id("com.netflix.nebula.ospackage") version "11.4.0"
id 'org.gradle.crypto.checksum' version '1.4.0' id 'org.gradle.crypto.checksum' version '1.4.0'
id 'signing'
} }
repositories { repositories {
@ -36,7 +37,7 @@ task createChecksums(type: Checksum) {
doLast { doLast {
def artifactChecksumsSha256Hex = new HashMap<String, String>() def artifactChecksumsSha256Hex = new HashMap<String, String>()
for (final def file in outputDirectory.get().getAsFileTree().files) { for (final def file in outputDirectory.get().getAsFileTree().files) {
if (file.toString().endsWith('mapping.map')) { if (file.toString().endsWith('mapping.map') || file.toString().endsWith('.asc')) {
continue continue
} }
@ -90,4 +91,18 @@ if (rootProject.fullVersion) {
apply from: 'choco.gradle' apply from: 'choco.gradle'
apply from: 'winget.gradle' apply from: 'winget.gradle'
apply from: 'install.gradle' apply from: 'install.gradle'
signing {
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
}
task signArtifacts(type: Sign) {
def dir = layout.buildDirectory.dir("dist/artifacts").get()
dir.asFileTree.files.forEach {sign(it)}
}
task signChecksums(type: Sign) {
def checksums = layout.buildDirectory.file("dist/checksums/sha256sums.txt").get().asFile
sign(checksums)
}
} }

View file

@ -28,13 +28,8 @@ publishing {
} }
} }
def signingKeyId = project.hasProperty('signingKeyId') ? project.property("signingKeyId") : System.getenv('GPG_KEY_ID')
def signingKey = project.hasProperty('signingKeyFile') ? file(project.property("signingKeyFile")).text : System.getenv('GPG_KEY')
def signingPassword = project.hasProperty('signingPassword') ? project.property("signingPassword") : System.getenv('GPG_KEY_PASSWORD')
signing { signing {
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword != null ? signingPassword : '') useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign publishing.publications.mavenJava sign publishing.publications.mavenJava
} }