lancegatlin / sbt-release-gitflow

Extension of sbt-release for git flow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sbt-release-gitflow: sbt plugin that handles all gitflow release steps

Warning

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"

Add to your project

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.

Commands

Create a new release

Command: releaseCreate

Overview:

  1. Create a new gitflow release branch (default name: 'release/X.Y.Z')

    1. Note: release branch version will be the same as develop

  2. Advance the version number of the develop branch '-SNAPSHOT' version

  3. Push everything to origin

  4. Compile, test and publish the develop branch with the new version number

  5. Checkout the release branch

  6. Compile, test and publish the release branch

Command Options

  • 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

Close release

Command: releaseClose

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

Overview

  1. Ensure no '-SNAPSHOT' dependencies are present in the SBT project

  2. Compile and test the project

  3. Remove '-SNAPSHOT' from version in version.sbt, commit change

  4. Tag commit 'vX.Y.Z'

  5. Merge release branch into master branch

  6. Delete release branch

  7. Push everything to origin

  8. Publish master branch

Command Options

  • 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

Abort release

Command: releaseAbort

Overview

  1. Find open release branch

  2. Delete the branch locally and remotely

Command Options

  • 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-push

    • Don’t push changes to origin

Build options

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'

About

Extension of sbt-release for git flow

License:MIT License


Languages

Language:Scala 100.0%