forked from akka/akka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRelease.scala
50 lines (43 loc) · 1.88 KB
/
Release.scala
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
package akka
import sbt._
import sbt.Keys._
import java.io.File
import com.typesafe.sbt.site.SphinxSupport.{ generate, Sphinx }
import com.typesafe.sbt.pgp.PgpKeys.publishSigned
import com.typesafe.sbt.S3Plugin.S3
object Release {
val releaseDirectory = SettingKey[File]("release-directory")
lazy val settings: Seq[Setting[_]] = commandSettings ++ Seq(
releaseDirectory <<= crossTarget / "release"
)
lazy val commandSettings = Seq(
commands ++= Seq(buildReleaseCommand, uploadReleaseCommand)
)
def buildReleaseCommand = Command.command("build-release") { state =>
val extracted = Project.extract(state)
val release = extracted.get(releaseDirectory)
val releaseVersion = extracted.get(version)
val projectRef = extracted.get(thisProjectRef)
val repo = extracted.get(Publish.defaultPublishTo)
val state1 = extracted.runAggregated(publishSigned in projectRef, state)
val (state2, (api, japi)) = extracted.runTask(Unidoc.unidoc, state1)
val (state3, docs) = extracted.runTask(generate in Sphinx, state2)
val (state4, dist) = extracted.runTask(Dist.dist, state3)
val (state5, activatorDist) = extracted.runTask(ActivatorDist.activatorDist in LocalProject(AkkaBuild.samples.id), state4)
IO.delete(release)
IO.createDirectory(release)
IO.copyDirectory(repo, release / "releases")
IO.copyDirectory(api, release / "api" / "akka" / releaseVersion)
IO.copyDirectory(japi, release / "japi" / "akka" / releaseVersion)
IO.copyDirectory(docs, release / "docs" / "akka" / releaseVersion)
IO.copyFile(dist, release / "downloads" / dist.name)
for (f <- (activatorDist * "*.zip").get)
IO.copyFile(f, release / "downloads" / f.name)
state5
}
def uploadReleaseCommand = Command.command("upload-release") { state =>
val extracted = Project.extract(state)
val (state1, _) = extracted.runTask(S3.upload, state)
state1
}
}