From 50ba4342520e2b14ddd3d86c54ca427a69f43824 Mon Sep 17 00:00:00 2001 From: Brent Pitman Date: Mon, 13 Jul 2015 14:42:14 -0700 Subject: [PATCH] Fix release version and snapshot credentials --- project/Bintray.scala | 9 +++++---- project/GitVersion.scala | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/project/Bintray.scala b/project/Bintray.scala index 96e7d6b9..98dbdbef 100644 --- a/project/Bintray.scala +++ b/project/Bintray.scala @@ -5,6 +5,10 @@ import bintray.BintrayKeys._ object Bintray { + lazy val (user, pass) = { + if (isPullRequest) ("dummyUser", "dummyPass") + else (sys env "bintrayUser", sys env "bintrayKey") + } lazy val storeBintrayCredentials = taskKey[Unit]("store bintray credentials") lazy val settings: Seq[Def.Setting[_]] = Seq( @@ -13,6 +17,7 @@ object Bintray { bintrayOrganization := Some("netflixoss"), bintrayReleaseOnPublish := false, licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt")), + credentials += Credentials("Artifactory Realm", "oss.jfrog.org", user, pass), publishTo := { if (isSnapshot.value) Some("jfrog" at "https://oss.jfrog.org/oss-snapshot-local/") @@ -21,10 +26,6 @@ object Bintray { storeBintrayCredentials := { val isPullRequest = sys.env.getOrElse("TRAVIS_PULL_REQUEST", "false") != "false" - val (user, pass) = { - if (isPullRequest) ("dummyUser", "dummyPass") - else (sys env "bintrayUser", sys env "bintrayKey") - } IO.write(bintrayCredentialsFile.value, api.template(user, pass)) }, diff --git a/project/GitVersion.scala b/project/GitVersion.scala index b7fdcc10..5b30dba8 100644 --- a/project/GitVersion.scala +++ b/project/GitVersion.scala @@ -5,12 +5,13 @@ import com.typesafe.sbt.SbtGit._ object GitVersion { lazy val settings: Seq[Def.Setting[_]] = Seq( version in ThisBuild := { - val descVersion = """v?([0-9\.]+)-(\d+)-([0-9a-z]+)""".r + val snapshotVersion = """v?([0-9\.]+)-(\d+)-([0-9a-z]+)""".r + val releaseVersion = """v?([0-9\.]+)""".r val isPullRequest = sys.env.getOrElse("TRAVIS_PULL_REQUEST", "false") != "false" git.gitDescribedVersion.value getOrElse "0.1-SNAPSHOT" match { case v if (isPullRequest) => s"0.0.0-PULLREQUEST" - case descVersion(v, "0", _) => v - case descVersion(v, n, h) => s"${v}-SNAPSHOT"//s"${v}-${"%02d".format(n.toInt)}-${h}-SNAPSHOT" + case snapshotVersion(v, n, h) => s"${v}-${"%02d".format(n.toInt)}-${h}-SNAPSHOT" + case releaseVersion(v) => v case v => v } }