semver

command module
v1.5.14 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: MIT Imports: 2 Imported by: 0

README

build codecov Go Score Go Version slack

semver

A command-line tool that automates semantic versioning by analysing git commit history using conventional commits. It determines the appropriate version bump (MAJOR, MINOR, PATCH) based on commit types and creates git tags automatically.

Features

  • Automatic Version Calculation: Analyses commit history to determine the next semantic version
  • Conventional Commits Support: Parses commit messages following the conventional commits specification
  • Breaking Change Detection: Automatically bumps MAJOR version for breaking changes
  • Floating Tags: Optionally creates floating version tags (v1, v1.2) alongside full versions
  • Cross-Platform: Builds for Linux and macOS (amd64/arm64)
  • JSON Output: Structured output for easy integration with CI/CD pipelines
  • Azure DevOps Support: Handles Azure DevOps merged PR commit format

Quick Start

Installation
# Clone and build from source
git clone https://github.com/martoc/semver.git
cd semver
make init && make build

# Binary is available at target/builds/semver-<os>-<arch>
Basic Usage
# Calculate next version (creates tag)
semver calculate

# Preview version without creating tags
semver calculate --disable-tagging

# Calculate and push tags to remote
semver calculate --push

# Include floating tags (v1, v1.2)
semver calculate --add-floating-tags
Output
{
  "next_version": "1.2.3",
  "floating_version_major": "1",
  "floating_version_minor": "1.2"
}

How It Works

flowchart LR
    A[Git History] --> B[Find Latest Tag]
    B --> C[Parse HEAD Commit]
    C --> D{Commit Type}
    D -->|feat| E[MINOR Bump]
    D -->|fix/chore/etc| F[PATCH Bump]
    D -->|BREAKING CHANGE| G[MAJOR Bump]
    E --> H[Create Tag]
    F --> H
    G --> H

Version Bump Rules

Commit Type Version Bump Example
feat MINOR feat: add new feature
fix, chore, docs, etc. PATCH fix: resolve bug
BREAKING CHANGE or ! suffix MAJOR feat!: breaking change

Documentation

Development

make init      # Install dependencies
make build     # Build binaries
make test      # Run unit tests
make lint      # Run linter
make run-integration-tests  # Run integration tests

Licence

MIT - see LICENSE for details.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package core provides the core functionality for version calculation and tagging.
Package core provides the core functionality for version calculation and tagging.

Jump to

Keyboard shortcuts

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