Skip to content

Commit

Permalink
Fix Gradle failed when "servers.github.privKey" is not specified. (#699)
Browse files Browse the repository at this point in the history
Signed-off-by: Yahor Berdnikau <[email protected]>
  • Loading branch information
Tapchicoma authored Feb 16, 2020
1 parent b4856dc commit 8caa30b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ tasks.withType(Wrapper.class).configureEach {
}

// Deployment tasks
String getGithubToken() {
if (project.hasProperty("servers.github.privKey")) {
return project.'servers.github.privKey'
} else {
logger.warn("No github token specified")
return ""
}
}

// Put "servers.github.privKey" in "$HOME/.gradle/gradle.properties".
def announceTask = tasks.register("announceRelease", Exec.class) { announceTask ->
Expand All @@ -79,7 +87,7 @@ def announceTask = tasks.register("announceRelease", Exec.class) { announceTask

commandLine './.announce', '-y'
environment VERSION: "${project.'VERSION_NAME'}"
environment GITHUB_TOKEN: "${project.'servers.github.privKey'}"
environment GITHUB_TOKEN: "${getGithubToken()}"
}

tasks.register("publishNewRelease", DefaultTask.class) {
Expand Down

0 comments on commit 8caa30b

Please sign in to comment.