Documentation
¶
Index ¶
Constants ¶
const Auto = "auto"
Auto mode name for AutoMode.
const GitBranch = "git-branch"
GitBranch mode name for GitBranchMode.
const GitCommit = "git-commit"
GitCommit mode name for GitCommitMode.
const Major = "major"
Major semver version level for major
const Minor = "minor"
Minor semver version level for minor
const Patch = "patch"
Patch semver version level for patch
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { GitBranchMode GitBranchMode GitCommitMode GitCommitMode }
API an API to work with different modes.
func NewAPI ¶
func NewAPI(gitBranchMode GitBranchMode, gitCommitMode GitCommitMode) API
NewAPI creates a new semver mode API. Returns the new API.
func (API) SelectMode ¶
SelectMode selects the mode corresponding to the mode string. Returns the corresponding mode.
type AutoMode ¶
type AutoMode struct {
Modes []Mode
}
AutoMode implementation of the Mode interface. It makes use of several modes and defaults to PatchMode as a last resort.
func NewAutoMode ¶
NewAutoMode creates a new AutoMode. The order of modes in the modes slices is important and determines in which order the modes are applied in AutoMode.Increment. Returns the new AutoMode.
func (AutoMode) Increment ¶
func (autoMode AutoMode) Increment(prefix string, suffix string, targetVersion string) (nextVersion string, err error)
Increment increments a given version using AutoMode. It will attempt to increment the target version with its internal modes and defaults to PatchMode as a last resort. Returns the incremented version or an error if anything went wrong.
type GitBranchMode ¶
GitBranchMode implementation of the Mode interface. It increments the semver level based on the naming of the source branch of a git merge.
func NewGitBranchMode ¶
func NewGitBranchMode(delimiters string, semverMap semver.Map) GitBranchMode
NewGitBranchMode creates a new GitBranchMode. Returns the new GitBranchMode.
func (GitBranchMode) Increment ¶
func (mode GitBranchMode) Increment(prefix string, suffix string, targetVersion string) (nextVersion string, err error)
Increment increments the semver level based on the naming of the source branch of a git merge. Returns the incremented version or an error if the last git commit is not a merge or if no mode was detected based on the branch name.
func (GitBranchMode) String ¶ added in v1.3.0
func (mode GitBranchMode) String() string
String returns a string representation of an instance.
type GitCommitMode ¶
GitCommitMode implementation of the Mode interface. It increments the semver level based on the latest git commit messages.
func NewGitCommitMode ¶
func NewGitCommitMode(delimiters string, semverMap semver.Map) GitCommitMode
NewGitCommitMode creates a new GitCommitMode. Returns the new GitCommitMode.
func (GitCommitMode) Increment ¶
func (mode GitCommitMode) Increment(prefix string, suffix string, targetVersion string) (nextVersion string, err error)
Increment increments a given version based on the latest git commit message. Returns the incremented version or an error if it failed to detect the mode based on the git commit.
func (GitCommitMode) String ¶ added in v1.3.0
func (mode GitCommitMode) String() string
String returns a string representation of an instance.
type MajorMode ¶
type MajorMode struct{}
MajorMode implementation of the Mode interface. It makes use of the major level of semver versions.
func NewMajorMode ¶
func NewMajorMode() MajorMode
NewMajorMode creates a new MajorMode. Returns the new MajorMode.
type MinorMode ¶
type MinorMode struct{}
MinorMode implementation of the Mode interface. It makes use of the minor level of semver versions.
func NewMinorMode ¶
func NewMinorMode() MinorMode
NewMinorMode creates a new MinorMode. Returns the new MinorMode.
type Mode ¶
type Mode interface { Increment(prefix string, suffix string, targetVersion string) (nextVersion string, err error) String() string }
Mode interface which increments a specific semver level.
func DetectModeFromString ¶ added in v1.7.2
func DetectModesFromString ¶ added in v1.7.2
func DetectModesFromString(str string, semverMap semver.Map, delimiters string) (detected []Mode, err error)
DetectModesFromString detects multiple modes based on a string. Mode detection is limited to PatchMode, MinorMode, MajorMode. The order of a detected modes is relative to their position in the string. Returns a slice of the detected modes.
type PatchMode ¶
type PatchMode struct{}
PatchMode implementation of the Mode interface. It makes use of the patch level of semver versions.
func NewPatchMode ¶
func NewPatchMode() PatchMode
NewPatchMode creates a new PatchMode. Returns the new PatchMode.