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):
- Verify git is installed
- Check branch (main/master unless bypassed)
- Check for uncommitted changes
- Get current version from git tags
- Calculate new version
- Read current changelog content (for rollback)
Phase 2 — Mutate (with rollback on failure):
- Update changelog file
- Commit changelog
- Create git tag
- 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.
Click to show internal directories.
Click to hide internal directories.