nextversion

module
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2025 License: MIT

README

nextversion

Automatic semantic versioning utility

Latest Release Version Godoc Build Status Go Report Card codecov CodeQL

nextversion detects current application version based on git tags and suggests a bumped version based on conventional commit messages.

Constraints

  • nextversion needs annotated git tags to determine the current app version
  • nextversion does not create tags for you, it only generates a suggestion
  • nextversion sticks to Semantic Versioning and Conventional Commits:
    • your tags must follow the semver pattern without prerelease suffix and an optional v prefix (e.g. v1.2.3 or 1.2.3).
    • you have to make sure that commit messages follow the Conventional Commits spec.
      The used parser is in best effort mode

Usage

# Let's check the CLI help screen

$ nextversion --help
NAME:
   nextversion - versioning helper tool

USAGE:
   nextversion [global options] [command]

VERSION:
   v0.5.1

DESCRIPTION:
   nextversion detects application version based on git tags and suggests a bumped version based on conventional commits.

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --repo PATH, -r PATH                   PATH to a git repository (default: "./")
   --format FORMAT, -f FORMAT             Output FORMAT (simple, json) (default: "simple")
   --default-current VERSION, -d VERSION  Fallback current VERSION if none could be detected (default: "v0.0.0")
   --pre-stable, -p                       Breaking changes will not increase major version if current version matches v0.*.* (default: false)
   --force-stable, -s                     Force updating to at least v1.0.0 (this has precedence over the --pre-stable flag) (default: false)
   --help, -h                             show help
   --version, -v                          print version of this tool (default: false)

# Run nextversion 

~/my-repo$ nextversion
CURRENT=v0.1.2
CURRENT_STRICT=0.1.2
HAS_CURRENT=true
NEXT=v0.2.0
NEXT_STRICT=0.2.0
HAS_NEXT=true
PRERELEASE=v0.2.0-rc+main.cd81544
PRERELEASE_STRICT=0.2.0-rc+main.cd81544
PRERELEASE_DOCKER_TAG=0.2.0-rc-main.cd81544

# Please return JSON and make it readable

~/my-repo$ nextversion -f json | jq
{
  "current": "v0.1.2",
  "current-strict": "0.1.2",
  "has-current": true,
  "next": "v0.2.0",
  "next-strict": "0.2.0",
  "has-next": true,
  "prerelease": "v0.2.0-rc+main.cd81544",
  "prerelease-strict": "0.2.0-rc+main.cd81544",
  "prerelease-docker-tag": "0.2.0-rc-main.cd81544"
}

Directories

Path Synopsis
cmd
nextversion command
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL