Skip to content

Commit

Permalink
Merge pull request #125 from bpitman/master
Browse files Browse the repository at this point in the history
fix snapshot release?
  • Loading branch information
bpitman committed Jul 13, 2015
2 parents 3451ab5 + 3876f1e commit 33ac312
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
11 changes: 6 additions & 5 deletions project/Bintray.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import bintray.BintrayKeys._

object Bintray {

lazy val isPullRequest = sys.env.getOrElse("TRAVIS_PULL_REQUEST", "false") != "false"
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,18 +18,14 @@ 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/")
else publishTo.value
},

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 33ac312

Please sign in to comment.