From 25ad8f6ad4dbba5a84dc3b649fed9efdf2e466c6 Mon Sep 17 00:00:00 2001 From: Sterling Greene Date: Thu, 15 Oct 2020 15:23:03 -0400 Subject: [PATCH] Wire in credentials for publishing the plugin from the environment --- build.gradle.kts | 10 ++++++++++ 1 file changed, 10 insertions(+) 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"