diff --git a/admin/build.sh b/admin/build.sh index 7cb5c34a..39e8f8b9 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,12 @@ 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 ]] && [[ "$TRAVIS_PULL_REQUEST" = false ]]; then + publish=yes +fi + +if [[ "$publish" = yes ]]; then extraTarget="+publish-signed" cat admin/gpg.sbt >> project/plugins.sbt cp admin/publish-settings.sbt . 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") +