plugin publishing tokens

This commit is contained in:
Steve Ebersole 2021-08-04 11:17:25 -05:00
parent 8ab124d5f3
commit ac8a212393
1 changed files with 17 additions and 15 deletions

View File

@ -107,22 +107,24 @@ afterEvaluate {
}
gradle.taskGraph.whenReady { tg ->
// look for sys-prop or env-var overrides of the tokens used for publishing
if ( System.properties.containsKey( 'gradle.publish.key' )
|| System.properties.containsKey( 'gradle.publish.secret' )
|| System.getenv().containsKey( 'GRADLE_PUBLISH_KEY' )
|| System.getenv().containsKey( 'GRADLE_PUBLISH_SECRET' ) ) {
// nothing to do - already explicitly set
}
else {
// use the values from the credentials provider, if any
if ( credentials.hibernatePluginPortalUsername == null ) {
throw new RuntimeException( "`hibernatePluginPortalUsername` not found" )
if ( tg.hasTask( project.tasks.publishPlugins ) ) {
// look for sys-prop or env-var overrides of the tokens used for publishing
if ( System.properties.containsKey( 'gradle.publish.key' )
|| System.properties.containsKey( 'gradle.publish.secret' )
|| System.getenv().containsKey( 'GRADLE_PUBLISH_KEY' )
|| System.getenv().containsKey( 'GRADLE_PUBLISH_SECRET' ) ) {
// nothing to do - already explicitly set
}
if ( credentials.hibernatePluginPortalPassword == null ) {
throw new RuntimeException( "`hibernatePluginPortalPassword` not found" )
else {
// use the values from the credentials provider, if any
if ( credentials.hibernatePluginPortalUsername == null ) {
throw new RuntimeException( "`hibernatePluginPortalUsername` not found" )
}
if ( credentials.hibernatePluginPortalPassword == null ) {
throw new RuntimeException( "`hibernatePluginPortalPassword` not found" )
}
System.setProperty( 'gradle.publish.key', credentials.hibernatePluginPortalUsername )
System.setProperty( 'gradle.publish.secret', credentials.hibernatePluginPortalPassword )
}
System.setProperty( 'gradle.publish.key', credentials.hibernatePluginPortalUsername )
System.setProperty( 'gradle.publish.secret', credentials.hibernatePluginPortalPassword )
}
}