diff --git a/build.gradle.kts b/build.gradle.kts index 3a65d38c..d28e7ecd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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"