Skip to content
This repository was archived by the owner on Oct 10, 2023. It is now read-only.

Commit 22e9dfb

Browse files
authored
Use git tags for versioning (#35)
1 parent f497951 commit 22e9dfb

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

build.sbt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ lazy val root = (project in file("."))
22
.settings(
33
name := "scala-http-client",
44
organization := "io.moia",
5-
version := "1.3.1",
65
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0")),
76
scmInfo := Some(ScmInfo(url("https://github.com/moia-dev/scala-http-client"), "scm:git@github.com:moia-dev/scala-http-client.git")),
87
homepage := Some(url("https://github.com/moia-dev/scala-http-client")),
@@ -24,6 +23,11 @@ lazy val root = (project in file("."))
2423
Defaults.itSettings,
2524
scalacOptions in IntegrationTest := (scalacOptions in Compile).value.filterNot(_ == "-Ywarn-dead-code")
2625
)
26+
.settings(sbtGitSettings)
27+
.enablePlugins(
28+
GitVersioning,
29+
GitBranchPrompt
30+
)
2731

2832
val akkaVersion = "2.6.4"
2933
val akkaHttpVersion = "10.1.11"
@@ -93,3 +97,17 @@ lazy val sonatypeSettings = {
9397
credentials += Credentials(Path.userHome / ".sbt" / "sonatype_credential")
9498
)
9599
}
100+
101+
lazy val sbtVersionRegex = "v([0-9]+.[0-9]+.[0-9]+)-?(.*)?".r
102+
103+
lazy val sbtGitSettings = Seq(
104+
git.useGitDescribe := true,
105+
git.baseVersion := "0.0.0",
106+
git.uncommittedSignifier := None,
107+
git.gitTagToVersionNumber := {
108+
case sbtVersionRegex(v, "") => Some(v)
109+
case sbtVersionRegex(v, "SNAPSHOT") => Some(s"$v-SNAPSHOT")
110+
case sbtVersionRegex(v, s) => Some(s"$v-$s-SNAPSHOT")
111+
case _ => None
112+
}
113+
)

project/plugins.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.2")
1515

1616
// publishSigned
1717
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
18+
19+
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")

0 commit comments

Comments
 (0)