Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving release process #12

Merged
merged 4 commits into from
Feb 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ resolvers ++= Seq(
Resolver.url("laughedelic sbt-plugins", url("http://dl.bintray.com/laughedelic/sbt-plugins"))(Resolver.ivyStylePatterns)
)

dependencyOverrides += "org.apache.ivy" % "ivy" % "2.3.0"
dependencyOverrides ++= Set(
"org.apache.ivy" % "ivy" % "2.3.0",
"commons-codec" % "commons-codec" % "1.7",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.2.3"
)

addSbtPlugin("ohnosequences" % "sbt-s3-resolver" % "0.8.0")

addSbtPlugin("ohnosequences" % "sbt-github-release" % "0.1.0")

addSbtPlugin("com.github.gseitz" % "sbt-release" % "0.8.2")

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.10.1")
Expand Down
56 changes: 44 additions & 12 deletions src/main/scala/NiceSbtSettingsPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package ohnosequences.sbt

import sbt._
import Keys._
import sbt.Extracted

import sbtrelease._
import ReleaseStateTransformations._
import ReleasePlugin._
import ReleaseKeys._

import ohnosequences.sbt.SbtS3Resolver._
import ohnosequences.sbt.SbtGithubReleasePlugin._

import laughedelic.literator.plugin.LiteratorPlugin._

Expand Down Expand Up @@ -148,8 +150,33 @@ object NiceSettingsPlugin extends sbt.Plugin {
)
}

lazy val genDocsForRelease: ReleaseStep =
ReleaseStep({st => Project.extract(st).runTask(Literator.generateDocs, st)._1 })
lazy val genDocsAndCommit = ReleaseStep { st: State =>
val newSt = Project.extract(st).runAggregated(Literator.generateDocs, st)
Project.extract(newSt) get versionControlSystem map { vcs =>
if (vcs.status.!!.trim.nonEmpty) vcs.commit("Autogenerated documentation") ! st.log
}
newSt
}

lazy val checkPackaging = ReleaseStep { st: State =>
Project.extract(st).runAggregated(Keys.`package`, st)
}

lazy val checkGHCreds = ReleaseStep { st: State =>
Project.extract(st).runAggregated(GithubRelease.checkGithubCredentials, st)
}

lazy val releaseOnGHStep = ReleaseStep { st: State =>
Project.extract(st).runAggregated(GithubRelease.releaseOnGithub, st)
}

lazy val tempSetVersion = ReleaseStep { st: State =>
val v = st.get(versions).getOrElse(sys.error("No versions are set! Was this release part executed before inquireVersions?"))._1
st.log.info("Setting version to " + v)
reapply(Seq(
version in ThisBuild := v
), st)
}

lazy val releaseSettings: Seq[Setting[_]] =
ReleasePlugin.releaseSettings ++ Seq(
Expand All @@ -176,16 +203,21 @@ object NiceSettingsPlugin extends sbt.Plugin {
}
, releaseProcess := // use thisProjectRef.value if needed
Seq[ReleaseStep](
genDocsForRelease // <--
, checkSnapshotDependencies
, inquireVersions
, runTest
, setReleaseVersion
, commitReleaseVersion
, tagRelease
, publishArtifacts
, setNextVersion
, pushChanges
checkSnapshotDependencies // no snapshot deps in release
, checkGHCreds // check that we can publish Github release
, checkPackaging // try to package the artifacts
, genDocsAndCommit // generate literator docs and commit if needed
, runTest // compile and test
, inquireVersions // ask about release version and the next one
, tempSetVersion // set the chosed version for publishing
, publishArtifacts // try to publish artifacts
, setReleaseVersion // if it was ok, set the version finally
, commitReleaseVersion // and commit it
, tagRelease // and make a tag
, releaseOnGHStep // and publish notes on github
, setNextVersion // bump the version
, commitNextVersion // commit it
, pushChanges // and push everything to github
)
)

Expand Down