Skip to content

Commit

Permalink
Update external-config/build.grade to use inMemoryPgpKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
sbglasius committed Dec 28, 2023
1 parent 16c25f2 commit 05ac5b5
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions external-config/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,25 @@ publishing {
}
}

ext."signing.keyId" = project.findProperty('signing.keyId') ?: System.getenv('SIGNING_KEY')
ext."signing.password" = project.findProperty('signing.password') ?: System.getenv('SIGNING_PASSPHRASE')
ext."signing.secretKeyRingFile" = project.findProperty('signing.secretKeyRingFile') ?: (System.getenv('GITHUB_WORKSPACE') ? "${System.getenv('GITHUB_WORKSPACE')}/secring.gpg" : "${System.getProperty('user.home')}/.gnupg/secring.gpg")

ext.isReleaseVersion = !version.endsWith('SNAPSHOT')

afterEvaluate {
signing {
required { isReleaseVersion }
if (System.getenv('SIGN_ARMORED_KEY')) {
String signingKey = System.getenv('SIGN_ARMORED_KEY')
String signingPassword = System.getenv('SIGN_PASSWORD')
useInMemoryPgpKeys(signingKey, signingPassword)
} else {
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.password"] = System.getenv('SIGNING_PASSPHRASE')
ext["signing.secretKeyRingFile"] = System.getenv('SECRING_FILE')
}
required {
isReleaseVersion
}

sign publishing.publications.maven
}
}

tasks.withType(Sign).configureEach {
onlyIf { isReleaseVersion }
}

0 comments on commit 05ac5b5

Please sign in to comment.