Skip to content

Commit

Permalink
Wire in credentials for publishing the plugin from the environment
Browse files Browse the repository at this point in the history
  • Loading branch information
big-guy committed Oct 15, 2020
1 parent 38a43ed commit 25ad8f6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ gradlePlugin {
}
}

// Wire in the publishing credentials from the environment or as a project property
setFromEnvOrGradleProperty("gradle.publish.key", "GRADLE_PUBLISH_KEY")
setFromEnvOrGradleProperty("gradle.publish.secret", "GRADLE_PUBLISH_SECRET")

fun Project.setFromEnvOrGradleProperty(gradleProperty: String, environmentVariable: String) {
val envVar = providers.environmentVariable(environmentVariable).forUseAtConfigurationTime()
val gradleProp = providers.gradleProperty(gradleProperty).forUseAtConfigurationTime()
setProperty(gradleProperty, envVar.orElse(gradleProp).getOrNull())
}

pluginBundle {
website = "https://gradle.github.io/playframework/"
vcsUrl = "https://github.com/gradle/playframework"
Expand Down

0 comments on commit 25ad8f6

Please sign in to comment.