Please note, I don’t like, recommend or use gitflow outside my current job. It’s dogmatic and will unnecessarily complicate your code base. If you have a choice, do something, anything other than gitflow. I only created this plugin because the current SBT gitflow plugin is woefully out of date. I needed to bring some sanity to my daily grind. I’m also not going to maintain a release. Feel free to fork.
"Abandon all hope ye who enter here"
Based on https://github.com/sbt/sbt-release
Clone, and publishLocal
git clone https://github.com/lancegatlin/sbt-release-gitflow.git
cd sbt-release-gitflow
sbt publishLocal
Create (or add to) project/plugins.sbt:
addSbtPlugin("org.lancegatlin" % "sbt-release-gitflow" % "1.0.0-SNAPSHOT")
Add a new file, version.sbt in the root directory of your project:
version in ThisBuild := "X.Y.Z-SNAPSHOT"
Replace X,Y,Z above with your own version. Versioning in this plugin is aligned with semantic versioning (major.minor.bugfix) with the addition of the '-SNAPSHOT' suffix used to indicate the current version. '-SNAPSHOT' is used by JAR tooling to indicate a jar that could change at any time. JARs without '-SNAPSHOT' are assumed to be immutable.
-
Create a new gitflow release branch (default name: 'release/X.Y.Z')
-
Note: release branch version will be the same as develop
-
-
Advance the version number of the develop branch '-SNAPSHOT' version
-
Push everything to origin
-
Compile, test and publish the develop branch with the new version number
-
Checkout the release branch
-
Compile, test and publish the release branch
-
with-defaults
-
Don’t prompt for options, always pick the default. Use this when running in automation scripts.
-
-
dry-run
-
Don’t actually do anything, but print the git commands that will be fired
-
-
skip-tests
-
Don’t run tests
-
-
skip-publish
-
Don’t publish
-
-
skip-if-exists
-
Normally a fatal error occurrs if a release branch already exists. If this is set and release branch exists, checkout existing release branch and compile, test and publish it
-
-
skip-push
-
Don’t push changes to origin
-
Note1: all fixes should be committed to the release branch prior to running this command
Note2: all '-SNAPSHOT' dependencies must be manually removed from the SBT project prior to running this command
-
Ensure no '-SNAPSHOT' dependencies are present in the SBT project
-
Compile and test the project
-
Remove '-SNAPSHOT' from version in version.sbt, commit change
-
Tag commit 'vX.Y.Z'
-
Merge release branch into master branch
-
Delete release branch
-
Push everything to origin
-
Publish master branch
-
with-defaults
-
Don’t prompt for options, always pick the default. Use this when running in automation scripts.
-
-
dry-run
-
Don’t actually do anything, but print the git commands that will be fired
-
-
skip-tests
-
Don’t run tests
-
-
skip-publish
-
Don’t publish
-
-
skip-push
-
Don’t push changes to origin
-
These build options may be set in build.sbt (or other project Scala file):
-
releaseVersionBump
-
An instance of Bump trait that determines how a version string is incremented. Defaults to X.Y+1.Z
-
-
releaseCalcTagComment
-
A function that computes the git tag comment for a release version. Defaults to vX.Y.Z.
-
-
releaseCalcVersionChangeCommitMessage
-
A function that computes the git commit message for the release close commit. Defaults to 'Setting version to X.Y.Z'
-
-
releaseVersionFile
-
The file to write the version to. Defaults to version.sbt
-
-
calcGitflowReleaseBranchName
-
A function to compute the name of a release branch from the current version. Defaults to 'release/X.Y.Z'
-
Note: there are other finer grained undocumented options in https://github.com/lancegatlin/sbt-release-gitflow/blob/master/src/main/scala/sbtrelease/gitflow/ReleasePlugin.scala