Skip to content

Commit fa5bdb7

Browse files
Use in-memory PGP key for signing.
Use secret file and text via Jenkins, set Gradle properties via specially named environment variables.
1 parent 73bf250 commit fa5bdb7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Jenkinsfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ pipeline {
2222
"-PpreferredUsername=$MVN_REPO_LOGIN_USR " +
2323
"-PpreferredPassword=$MVN_REPO_LOGIN_PSW " +
2424
"-PversionPostFix=$versionPostfix"
25+
// Note: for key use Jenkins secret file with PGP key as text in ASCII-armored format.
26+
ORG_GRADLE_PROJECT_signingKeyFile = credentials('objectbox_signing_key')
27+
ORG_GRADLE_PROJECT_signingKeyId = credentials('objectbox_signing_key_id')
28+
ORG_GRADLE_PROJECT_signingPassword = credentials('objectbox_signing_key_password')
2529
}
2630

2731
options {

build.gradle

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ configure(subprojects.findAll { projectNamesToPublish.contains(it.name) }) {
8282
}
8383

8484
signing {
85-
if (project.hasProperty('signing.keyId') && project.hasProperty('signing.password') &&
86-
project.hasProperty('signing.secretKeyRingFile')) {
85+
if (project.hasProperty('signingKeyId')
86+
&& project.hasProperty('signingKeyFile')
87+
&& project.hasProperty('signingPassword')) {
88+
String signingKey = new File(signingKeyFile).text
89+
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
8790
sign configurations.archives
8891
} else {
8992
println "Signing information missing/incomplete for ${project.name}"

0 commit comments

Comments
 (0)