alejandrohdezma / sbt-ci-tag-next-version

SBT plugin that automatically tags your next release version

Version Matrix

SBT companion plugin for sbt-ci-release for fully automated releases

This plugin provides a set of SBT tasks that can be used to auto-increase the version number by using git tags.

Installation

Add the following line to your plugins.sbt file:

addSbtPlugin("com.alejandrohdezma" %% "sbt-ci-tag-next-version" % "0.1.0")

Usage

This plugin adds a set of tasks to your SBT project to allow auto-tagging next releases. Each of them detects the last version from the repository git tags and automatically tags the following version tag (both locally and remote).

  • ciTagNextMajorVersion: tags the next version by increasing the major coordinate and pushes it. For example: if the previous tag is v1.1.0, the next one will be v2.0.0.
  • ciTagNextMinorVersion: tags the next version by increasing the minor coordinate and pushes it. For example: if the previous tag is v1.1.0, the next one will be v1.2.0.
  • ciTagNextPatchVersion: tags the next version by increasing the patch coordinate and pushes it. For example: if the previous tag is v1.1.0, the next one will be v1.1.1.

This plugin uses sbt-dynver under the hood for fetching the last stable release, and thus it will be added as a dependency to your build.

Note on SemVer

The plugin will try to honor the version system your project is using. For example, if you are using v1, v2... and run sbt ciTagNextMajorVersion, a v3 tag will be created. But please take into account that if you choose any of the other commands a new coordinate will be added (v2.1 or v2.0.1).

Tag requirements (copied from sbt-dynver)

In order to be recognized by sbt-dynver, by default tags must begin with the lowercase letter 'v' followed by a digit.

If you're not seeing what you expect, then either start with this:

git tag -a v0.0.1 -m "Initial version tag for sbt-dynver"

or change the value of ThisBuild / dynverVTagPrefix to remove the requirement for the v-prefix:

ThisBuild / dynverVTagPrefix := false

or, more generally, use ThisBuild / dynverTagPrefix to fully customising tag prefixes, for example:

ThisBuild / dynverTagPrefix := "foo-" // our tags have the format foo-<version>, e.g. foo-1.2.3