Skip to content

Commit

Permalink
add sbt-sonatype to do the release
Browse files Browse the repository at this point in the history
  • Loading branch information
Mortimerp9 committed May 2, 2014
1 parent 0a6a2db commit e157973
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
44 changes: 37 additions & 7 deletions project/Build.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import sbt._
import sbt.Keys._
import com.typesafe.sbt.SbtPgp.PgpKeys.publishSigned

import xerial.sbt.Sonatype.SonatypeKeys._

import sbtrelease.ReleaseStateTransformations._
import sbtrelease.ReleasePlugin.ReleaseKeys._
import sbtrelease.ReleasePlugin
import sbtrelease.ReleaseStep
import sbtrelease.Utilities._
import sbtrelease.Vcs
import sbtrelease.releaseTask

import annotation.tailrec

Expand All @@ -17,7 +21,11 @@ object SumacBuild extends Build {
lazy val ext = Project("ext", file("ext"), settings = extSettings).settings(net.virtualvoid.sbt.graph.Plugin.graphSettings: _*) dependsOn(core)
lazy val extZk = Project("ext-zk", file("ext-zk"), settings = extZkSettings).settings(net.virtualvoid.sbt.graph.Plugin.graphSettings: _*) dependsOn(core)

def sharedSettings = Defaults.defaultSettings ++ ReleasePlugin.releaseSettings ++ BranchRelease.branchSettings ++ Seq(
def sharedSettings = Defaults.defaultSettings ++
ReleasePlugin.releaseSettings ++
BranchRelease.branchSettings ++
xerial.sbt.Sonatype.sonatypeSettings ++
Seq(
// version is managed by sbt-release in version.sbt
scalaVersion := "2.11.0",
organization := "com.quantifind",
Expand Down Expand Up @@ -55,7 +63,8 @@ object SumacBuild extends Build {
setReleaseVersion,
BranchRelease.makeBranch, //make a new rel/$version branch
commitReleaseVersion, // all changes happen here
publishArtifacts,
BranchRelease.publishSignedArtifacts,
releaseTask(sonatypeReleaseAll),
BranchRelease.pushBranch,
BranchRelease.moveToPreviousBranch,
setNextVersion, // bump to the next snapshot version
Expand All @@ -75,7 +84,7 @@ object SumacBuild extends Build {
},

publishArtifact in Test := false,

profileName := "com.quantifind",
pomIncludeRepository := { x => false },
pomExtra := (
<url>https://github.com/quantifind/Sumac</url>
Expand Down Expand Up @@ -103,10 +112,10 @@ object SumacBuild extends Build {
<url>http://github.com/ryanlecompte</url>
</developer>
<developer>
<id>pierre</id>
<name>Pierre Andrews</name>
<url>http://github.com/Mortimerp9</url>
</developer>
<id>pierre</id>
<name>Pierre Andrews</name>
<url>http://github.com/Mortimerp9</url>
</developer>
</developers>),
javacOptions ++= Seq("-target", "1.6", "-source", "1.6")
) //++ ScoverageSbtPlugin.instrumentSettings ++ CoverallsPlugin.coverallsSettings // waiting for 2.11.0 release
Expand Down Expand Up @@ -262,6 +271,27 @@ object BranchRelease {
branchName <<= (version in ThisBuild) map ( v => s"rel/$v" )
)

//////////////////////////////////////////////////////////////////////
// signed publish
//////////////////////////////////////////////////////////////////////

lazy val publishSignedArtifacts = ReleaseStep(
action = publishSignedArtifactsAction,
check = st => {
// getPublishTo fails if no publish repository is set up.
val ex = st.extract
val ref = ex.get(thisProjectRef)
Classpaths.getPublishTo(ex.get(publishTo in Global in ref))
st
},
enableCrossBuild = true
)
private lazy val publishSignedArtifactsAction = { st: State =>
val extracted = st.extract
val ref = extracted.get(thisProjectRef)
extracted.runAggregated(publishSigned in Global in ref, st)
}

}

object BranchReleaseKeys {
Expand Down
4 changes: 3 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
resolvers += Resolver.url("sbt-plugin-releases", new URL("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns)

addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.2.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.1")

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")

Expand Down

0 comments on commit e157973

Please sign in to comment.