From f79354f635417ae54ccd1666e90ce2a6af98f05e Mon Sep 17 00:00:00 2001 From: Daniel Silva Date: Tue, 5 Feb 2019 01:22:40 +0000 Subject: [PATCH 1/3] publish master commits --- admin/build.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/admin/build.sh b/admin/build.sh index 7cb5c34a..7f3700f6 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -19,6 +19,8 @@ set -e verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?" tagPat="^v$verPat(#$verPat#[0-9]+)?$" +publish=no + if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then currentJvmVer=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | sed 's/^1\.//' | sed 's/[^0-9].*//') @@ -39,6 +41,13 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then echo "Releasing $tagVer on Java version $currentJvmVer according to 'scalaVersionsByJvm' in build.sbt." fi + publish=yes +elif [[ "$TRAVIS_BRANCH" = master ]]; then + publishVersion='set every version := "0.0.'$(date +%Y%m%d)'-'$TRAVIS_COMMIT'"' + publish=yes +fi + +if [[ "$publish" = yes ]]; then extraTarget="+publish-signed" cat admin/gpg.sbt >> project/plugins.sbt cp admin/publish-settings.sbt . From baacd7138dc6085c7a4b22238866baeb401fc3ad Mon Sep 17 00:00:00 2001 From: Daniel Silva Date: Wed, 6 Feb 2019 00:26:09 +0000 Subject: [PATCH 2/3] use sbt-dynver --- admin/build.sh | 1 - build.sbt | 6 +++++- project/plugins.sbt | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/admin/build.sh b/admin/build.sh index 7f3700f6..546a0f76 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -43,7 +43,6 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then publish=yes elif [[ "$TRAVIS_BRANCH" = master ]]; then - publishVersion='set every version := "0.0.'$(date +%Y%m%d)'-'$TRAVIS_COMMIT'"' publish=yes fi diff --git a/build.sbt b/build.sbt index 2d10d0ac..a72bd2d1 100644 --- a/build.sbt +++ b/build.sbt @@ -18,7 +18,11 @@ scalaVersionsByJvm in ThisBuild := { name := "scala-async" repoName := "async" -version := "0.10.0-SNAPSHOT" +// When the git tag includes a scala version and/or jvm version, remove both from the release version +version in ThisBuild ~= (_.replaceFirst("#[^+]+", "")) + +// SNAPSHOT versions are not cached by consumers. Since sbt-dynver already sets unique versions, do not produce a snapshot version. +dynverSonatypeSnapshots in ThisBuild := false libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided" libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value % "test" // for ToolBox diff --git a/project/plugins.sbt b/project/plugins.sbt index 005d1e27..13ac96a4 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1 +1,3 @@ addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14") +addSbtPlugin("com.dwijnand" % "sbt-dynver" % "3.1.0") + From a21137fe3d8a7734fb4ef0e0029b2047ea57cd2e Mon Sep 17 00:00:00 2001 From: Daniel Silva Date: Wed, 6 Feb 2019 00:54:09 +0000 Subject: [PATCH 3/3] don't try to publish pull request builds --- admin/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/build.sh b/admin/build.sh index 546a0f76..39e8f8b9 100755 --- a/admin/build.sh +++ b/admin/build.sh @@ -42,7 +42,7 @@ if [[ "$TRAVIS_TAG" =~ $tagPat ]]; then fi publish=yes -elif [[ "$TRAVIS_BRANCH" = master ]]; then +elif [[ "$TRAVIS_BRANCH" = master ]] && [[ "$TRAVIS_PULL_REQUEST" = false ]]; then publish=yes fi