version

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package version provides version bump orchestration functionality.

This package handles the workflow for bumping semantic versions, including validation, changelog updates, git operations, and pushing changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bump

func Bump(cfg BumpConfig, output io.Writer) error

Bump performs a complete version bump workflow.

The workflow is atomic: if any step fails after mutations begin, all changes are rolled back (changelog restored, commit reverted, tag deleted).

Phase 1 — Preflight (no mutations):

  1. Verify git is installed
  2. Check branch (main/master unless bypassed)
  3. Check for uncommitted changes
  4. Get current version from git tags
  5. Calculate new version
  6. Read current changelog content (for rollback)

Phase 2 — Mutate (with rollback on failure):

  1. Update changelog file
  2. Commit changelog
  3. Create git tag
  4. Optionally push

Types

type BumpConfig

type BumpConfig struct {
	// BumpType specifies the type of bump: "major", "minor", or "patch"
	BumpType string

	// AllowAnyBranch bypasses the main/master branch check when true
	AllowAnyBranch bool

	// AutoPush automatically pushes changes and tags to remote when true
	AutoPush bool

	// ChangelogFile is the path to the changelog file
	ChangelogFile string

	// RepositoryProvider specifies the git provider (github, gitlab, bitbucket)
	RepositoryProvider string

	// UseVPrefix determines whether to add 'v' prefix to version tags
	UseVPrefix bool
}

BumpConfig holds all configuration needed for a version bump operation.

Jump to

Keyboard shortcuts

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