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 -> gradle.taskGraph.whenReady { tg ->
// look for sys-prop or env-var overrides of the tokens used for publishing if ( tg.hasTask( project.tasks.publishPlugins ) ) {
if ( System.properties.containsKey( 'gradle.publish.key' ) // look for sys-prop or env-var overrides of the tokens used for publishing
|| System.properties.containsKey( 'gradle.publish.secret' ) if ( System.properties.containsKey( 'gradle.publish.key' )
|| System.getenv().containsKey( 'GRADLE_PUBLISH_KEY' ) || System.properties.containsKey( 'gradle.publish.secret' )
|| System.getenv().containsKey( 'GRADLE_PUBLISH_SECRET' ) ) { || System.getenv().containsKey( 'GRADLE_PUBLISH_KEY' )
// nothing to do - already explicitly set || 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 ( credentials.hibernatePluginPortalPassword == null ) { else {
throw new RuntimeException( "`hibernatePluginPortalPassword` not found" ) // 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 )
} }
} }