-
-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathrelease.sbt
51 lines (43 loc) · 1.51 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
import scala.sys.process._
import sbtrelease.ReleaseStateTransformations._
lazy val ensureJDK11: ReleaseStep = { st: State =>
val javaVersion = System.getProperty("java.specification.version")
if (javaVersion != "11") throw new IllegalStateException("Cancelling release, please use JDK 11")
st
}
lazy val updateVersionInReadmeAndExamples: ReleaseStep = { st: State =>
val extracted = Project.extract(st)
val newVersion = extracted.get(version)
val oldVersion = "git describe --abbrev=0".!!.trim.replaceAll("^v", "")
def updateFile(path: String): Unit = {
val oldContent = IO.read(file(path))
val newContent = oldContent
.replaceAll('"' + oldVersion + '"', '"' + newVersion + '"')
.replaceAll('-' + oldVersion + '-', '-' + newVersion + '-')
.replaceAll(':' + oldVersion + '"', ':' + newVersion + '"')
IO.write(file(path), newContent)
s"git add $path" !! st.log
}
updateFile("README.md")
(1 to 3).foreach(n => updateFile(s"jsoniter-scala-examples/example0$n.sc"))
st
}
releaseCrossBuild := false
releaseProcess := Seq[ReleaseStep](
ensureJDK11,
checkSnapshotDependencies,
inquireVersions,
runClean,
releaseStepCommandAndRemaining("+test"),
setReleaseVersion,
releaseStepCommandAndRemaining("+mimaReportBinaryIssues"),
updateVersionInReadmeAndExamples,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
releaseStepCommand("sonatypeBundleRelease"),
setNextVersion,
commitNextVersion,
pushChanges
)
releaseVcsSign := true