This repository has been archived by the owner on Oct 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
/
release.sbt
60 lines (53 loc) · 1.72 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
55
56
57
58
59
60
import sbtrelease._
import ReleaseTransformations._
val sonatypeURL = "https://oss.sonatype.org/service/local/repositories/"
val updateReadme = { state: State =>
val extracted = Project.extract(state)
val scalaV = extracted get scalaBinaryVersion
val v = extracted get version
val org = extracted get organization
val n = extracted get name
val snapshotOrRelease =
if (extracted get isSnapshot) "snapshots" else "releases"
val readme = "README.md"
val readmeFile = file(readme)
val newReadme = Predef
.augmentString(IO.read(readmeFile))
.lines
.map { line =>
val matchReleaseOrSnapshot = line.contains("SNAPSHOT") == v.contains(
"SNAPSHOT"
)
if (line.startsWith("libraryDependencies") && matchReleaseOrSnapshot) {
s"""libraryDependencies += "${org}" %% "${n}" % "$v""""
} else line
}
.mkString("", "\n", "\n")
IO.write(readmeFile, newReadme)
val git = new Git(extracted get baseDirectory)
git.add(readme) ! state.log
//FIXME 署名を入れるかどうか確認
git.commit("update " + readme, sign = false, signOff = false) ! state.log
// "git diff HEAD^" ! state.log
state
}
commands += Command.command("updateReadme")(updateReadme)
val updateReadmeProcess: ReleaseStep = updateReadme
releaseCrossBuild := true
releasePublishArtifactsAction := PgpKeys.publishSigned.value
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
updateReadmeProcess,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
setNextVersion,
commitNextVersion,
updateReadmeProcess,
ReleaseStep(action = Command.process("sonatypeReleaseAll", _)),
pushChanges
)