Skip to content

Next Semantic Version

nsv core principles of being context-aware and convention-based will let you achieve almost all of your semantic versioning needs when running:

nsv next

By scanning all commit messages within the latest release, nsv understands the author's intent and prints the next semantic version to stdout.

If you want to see what is happening under the hood:

NSV_SHOW=true nsv next
nsv next --show
0.2.0
┌───────────────┬──────────────────────────────────────────────────┐
│  0.2.0        │ > e0ba951                                        │
│  ↑↑           │   docs: document new exciting feature            │
│  0.1.0        │                                                  │
│               │ ✓ 2020953                                        │
│               │   >>feat<<: a new exciting feature               │
│               │                                                  │
│               │ > 709a467                                        │
│               │   ci: add github workflows                       │
└───────────────┴──────────────────────────────────────────────────┘

If you need to customize its behavior, environment variables, CLI flags, or commands can be used.

Configurable paths for monorepo support

Monorepo support is important to the design of nsv. By adding support for context paths, multiple semantic versions can be resolved throughout a repository in a single operation.

nsv next src/ui src/search

Any version change will be printed to stdout as a comma separated list in context path order:

ui/0.2.1,search/0.3.0

Version template customization

Internally nsv utilizes a go template when constructing the next semantic version:

{{.Prefix}}{{.Version}}

Runtime customization of this template is available. For example, you can enforce explicit semantic version usage:

NSV_FORMAT="{{.SemVer}}" nsv next
nsv next --format "{{.SemVer}}"

Head over to the playground to discover more.