HHH-15236 - Fix signing of published artifacts
This commit is contained in:
parent
a2e39a1757
commit
a39bf55a65
|
@ -13,7 +13,6 @@ buildscript {
|
|||
dependencies {
|
||||
classpath 'org.hibernate.build.gradle:version-injection-plugin:1.0.0'
|
||||
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.7'
|
||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
|
||||
classpath 'de.thetaphi:forbiddenapis:3.2'
|
||||
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.1'
|
||||
}
|
||||
|
|
|
@ -97,22 +97,48 @@ publishing {
|
|||
}
|
||||
|
||||
signing {
|
||||
required { !rootProject.ormVersion.isSnapshot && gradle.taskGraph.hasTask("publish") }
|
||||
|
||||
def signingKey = findProperty('signingKey')
|
||||
def signingPassword = findProperty('signingPassword')
|
||||
|
||||
useInMemoryPgpKeys(signingKey, signingPassword)
|
||||
var signingKey = resolveSigningKey()
|
||||
var signingPassword = findSigningProperty( "signingPassword" )
|
||||
useInMemoryPgpKeys( signingKey, signingPassword )
|
||||
|
||||
sign publishing.publications.publishedArtifacts
|
||||
}
|
||||
|
||||
String resolveSigningKey() {
|
||||
var key = findSigningProperty( "signingKey" )
|
||||
if ( key != null ) {
|
||||
return key
|
||||
}
|
||||
|
||||
var keyFile = findSigningProperty( "signingKeyFile" )
|
||||
if ( keyFile != null ) {
|
||||
return new File( keyFile ).text
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
String findSigningProperty(String propName) {
|
||||
if ( System.getProperty(propName ) != null ) {
|
||||
logger.lifecycle "Found `{}` as a system property", propName
|
||||
return System.getProperty(propName )
|
||||
}
|
||||
else if ( project.hasProperty( propName ) ) {
|
||||
logger.lifecycle "Found `{}` as a project property", propName
|
||||
return project.hasProperty( propName )
|
||||
}
|
||||
else {
|
||||
logger.lifecycle "Did not find `{}`", propName
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Release / publishing tasks
|
||||
|
||||
task ciBuild {
|
||||
dependsOn test, publish
|
||||
dependsOn test, publishToSonatype
|
||||
}
|
||||
|
||||
tasks.release.dependsOn tasks.test, tasks.publishToSonatype
|
||||
|
|
Loading…
Reference in New Issue