From fff5651bcf61afe93f4885859c10c0e9301e185f Mon Sep 17 00:00:00 2001 From: Christopher Batey Date: Wed, 8 Aug 2018 11:43:25 +0100 Subject: [PATCH] Fix gradle plugin publish (#330) * Travis command had missing quote * Versions that are a tag still ended up with a commit hash --- .travis.yml | 2 +- gradle-plugin/build.gradle | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ffffd0210..d026316da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,7 +31,7 @@ jobs: script: git branch -f "$TRAVIS_BRANCH" && git checkout "$TRAVIS_BRANCH" && sbt whitesourceCheckPolicies whitesourceUpdate - stage: publish script: sbt publish - - script: cd gradle-plugin && echo "gradle.publish.key=AwHNbsVBKA20KPzWQyCRbgGQHWa9Us5Y\ngradle.publish.secret=$GRADLE_SECRET' > ~/.gradle/gradle.properties && ./gradlew publishPlugins + - script: cd gradle-plugin && echo "gradle.publish.key=AwHNbsVBKA20KPzWQyCRbgGQHWa9Us5Y\ngradle.publish.secret=$GRADLE_SECRET" > ~/.gradle/gradle.properties && ./gradlew publishPlugins - stage: techhub-ping script: curl -I https://ci.lightbend.com/job/techhub-publisher/build?token=$TECH_HUB_TOKEN diff --git a/gradle-plugin/build.gradle b/gradle-plugin/build.gradle index fd817b29b..6ddbc537c 100644 --- a/gradle-plugin/build.gradle +++ b/gradle-plugin/build.gradle @@ -19,7 +19,11 @@ plugins { group = "com.lightbend.akka.grpc" // https://github.com/palantir/gradle-git-version/issues/97 -version "git describe --tags".execute().text.substring(1).split("-g")[0].replace('-', '+') + "-" + versionDetails().gitHash.substring(0, 8) + +def tag = "git describe --tags".execute().text.substring(1).split("-g")[0].replace("\n", "") +def finalVersion = (tag == versionDetails().lastTag.substring(1)) ? tag : tag.replace("-", "+") + "-" + versionDetails().gitHash.substring(0, 8) + +version = finalVersion gradlePlugin { plugins {