-
Notifications
You must be signed in to change notification settings - Fork 4
/
release.sbt
54 lines (45 loc) · 1.59 KB
/
release.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// NOTE: This file is generated by chored
import scala.util.Try
ThisBuild / scalaVersion := "2.13.11"
ThisBuild / organization := "net.gfxmonk"
sonatypeProfileName := "net.gfxmonk"
ThisBuild / version := {
def make(v: String, snapshot: Boolean) = if (snapshot) v + "-SNAPSHOT" else v
def isSnapshot: Try[Boolean] = sys.env.get("SNAPSHOT").map {
case "true" => true
case "false" => false
// NOTE: this is an abort, not a Try.Failure
case other => throw new RuntimeException(s"Invalid $$SNAPSHOT value: $other")
}.toRight(new RuntimeException("$SNAPSHOT required")).toTry
def fileVersion = {
// from file, we assume snapshot since that's the dev env
val base = Try(IO.read(new File("VERSION")).trim()).toOption
base.map { v => make(v, isSnapshot.getOrElse(true)) }
}
def envVersion = {
// from env, we require $SNAPSHOT to be set as well
sys.env.get("VERSION").map(v => make(v, isSnapshot.get))
}
envVersion.orElse(fileVersion).getOrElse(make("0.0.0", true))
}
ThisBuild / homepage := Some(url(s"https://github.com/timbertson/foperator"))
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/timbertson/foperator"),
s"scm:[email protected]:timbertson/foperator.git"
)
)
credentials += Credentials(
"Sonatype Nexus Repository Manager",
"oss.sonatype.org",
"timbertson",
sys.env.getOrElse("SONATYPE_PASSWORD", "******"))
ThisBuild / licenses := Seq("MIT" -> url("http://www.opensource.org/licenses/mit-license.php"))
ThisBuild / developers := List(
Developer(
id = "gfxmonk",
name = "Tim Cuthbertson",
email = "[email protected]",
url = url("http://gfxmonk.net")
)
)