Skip to content

Commit

Permalink
Fix release version and snapshot credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
bpitman committed Jul 13, 2015
1 parent ad87465 commit 50ba434
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions project/Bintray.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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/")
Expand All @@ -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))
},

Expand Down
7 changes: 4 additions & 3 deletions project/GitVersion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 50ba434

Please sign in to comment.