I have an SBT project and a CD pipeline and what I want is to execute the following sequence of steps:
- Checkout my project from the git repo
- Tag the commit
- Run the tests
- Package my app
Now at this point I don't want to release anything yet as I will promote the binaries to another environment to run the end-to-end tests. Only if they complete successfully would I want to push the git tags and upload my artefact to the remote artefactory repository. What I want to achieve really, is to be able to first run sbt prepereRelease
after which I will promote to my TEST environment and later, if everything goes ok, to run sbt doRelease
. So I want something similar to this in my build.sbt:
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
setNextVersion,
commitNextVersion
)
commands += Command.command("prepareRelease")((state:State) => {
val newState = Command.process("release",state)
println("Release called from prepareRelease...")
newState
})
releaseProcess := Seq[ReleaseStep](
publishArtifacts,
setNextVersion,
commitNextVersion,
pushChanges
)
commands += Command.command("doRelease")((state:State) => {
val newState = Command.process("release",state)
println("Release called from doRelease...")
newState
})
I almost feel like I will have to define two custom commands and each one will have to call the original release command from the sbt-release
plugin with a different releaseProcess
setting - that's the bit I don't know how to go about. Unfortunately the above setup won't work as the releaseProcess
setting accumulates the steps and you still end up with all the steps being executed at once.