Skip to content

Commit d3c96c3

Browse files
committed
Merge pull request msgpack#220 from xerial/publish-sonatype
Automate sbt release steps
2 parents d9919ee + 8c42beb commit d3c96c3

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

project/Build.scala

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ import de.johoop.findbugs4sbt.FindBugs._
2222
import de.johoop.jacoco4sbt._
2323
import JacocoPlugin._
2424
import sbtrelease.ReleasePlugin._
25+
import sbtrelease.ReleaseStateTransformations._
26+
import sbtrelease.ReleaseStep
2527
import scala.util.Properties
2628
import com.typesafe.sbt.pgp.PgpKeys
29+
import xerial.sbt.Sonatype.SonatypeKeys._
2730

2831
object Build extends Build {
2932

@@ -47,14 +50,36 @@ object Build extends Build {
4750
concurrentRestrictions in Global := Seq(
4851
Tags.limit(Tags.Test, 1)
4952
),
50-
ReleaseKeys.tagName <<= (version in ThisBuild) map (v => v),
5153
publishTo := {
5254
val nexus = "https://oss.sonatype.org/"
5355
if (isSnapshot.value)
5456
Some("snapshots" at nexus + "content/repositories/snapshots")
5557
else
5658
Some("releases" at nexus + "service/local/staging/deploy/maven2")
5759
},
60+
ReleaseKeys.tagName <<= (version in ThisBuild) map (v => v),
61+
ReleaseKeys.releaseProcess := Seq[ReleaseStep](
62+
checkSnapshotDependencies,
63+
inquireVersions,
64+
runClean,
65+
runTest,
66+
setReleaseVersion,
67+
commitReleaseVersion,
68+
tagRelease,
69+
ReleaseStep(
70+
action = { state =>
71+
val extracted = Project extract state
72+
extracted.runAggregated(PgpKeys.publishSigned in Global in extracted.get(thisProjectRef), state)
73+
}
74+
),
75+
setNextVersion,
76+
commitNextVersion,
77+
ReleaseStep{ state =>
78+
val extracted = Project extract state
79+
extracted.runAggregated(sonatypeReleaseAll in Global in extracted.get(thisProjectRef), state)
80+
},
81+
pushChanges
82+
),
5883
parallelExecution in jacoco.Config := false,
5984
// Since sbt-0.13.2
6085
incOptions := incOptions.value.withNameHashing(true),

0 commit comments

Comments
 (0)