nextversion

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BumpCapFlag       = "bump-cap"
	DependencyCapFlag = "dependency-cap"
)

Variables

View Source
var Cmd = &cli.Command{
	Name:  "next-version",
	Usage: "Prints the next version according to the current one, the changelog.yaml file, and semver conventions.",
	UsageText: `Current version is automatically discovered from git tags in the repository, in semver order. 
Tags that do not conform to semver standards are ignored.
Several flags can be specified to limit the set of tags that are scanned, and to override both the current version being
detected and the computed next version.
next-version will exit with an error if no previous versions are found in the git repository.`,
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:    tagPrefix,
			EnvVars: common.EnvFor(tagPrefix),
			Usage:   "Consider only tags matching this prefix for figuring out the current version.",
			Value:   "",
		},
		&cli.StringFlag{
			Name:    outputPrefix,
			EnvVars: common.EnvFor(outputPrefix),
			Usage:   "The prefix to prepend when printing the output version.",
			Value:   "v",
		},
		&cli.StringFlag{
			Name:    currentFlag,
			EnvVars: common.EnvFor(currentFlag),
			Usage:   "If set, overrides current version autodetection and assumes this one.",
			Value:   "",
		},
		&cli.StringFlag{
			Name:    nextFlag,
			EnvVars: common.EnvFor(nextFlag),
			Usage:   "If set, overrides next version computation and assumes this one instead.",
			Value:   "",
		},
		&cli.StringFlag{
			Name:    gitRootFlag,
			EnvVars: common.EnvFor(gitRootFlag),
			Usage:   "Path to the git repo to find tags on.",
			Value:   "./",
		},
		&cli.StringFlag{
			Name:    BumpCapFlag,
			EnvVars: common.EnvFor(BumpCapFlag),
			Usage:   "In case of having to bump the version of the package, limit to this semVer type",
			Value:   string(bump.MajorName),
		},
		&cli.StringFlag{
			Name:    DependencyCapFlag,
			EnvVars: common.EnvFor(DependencyCapFlag),
			Usage:   "In case of having to bump the version of base on a dependency, limit to this semVer type",
			Value:   string(bump.MajorName),
		},
		&cli.BoolFlag{
			Name:    failFlag,
			EnvVars: common.EnvFor(failFlag),
			Usage: "If set, command will exit with a code of 1 if no new version bump is produced. If not set," +
				"the current version will be returned.",
			Value: false,
		},
	},
	Action: NextVersion,
}

Cmd is the cli.Command object for the next-version command.

Functions

func NextVersion

func NextVersion(cCtx *cli.Context) error

NextVersion is a command function which loads a changelog.yaml file from disk and computes what the next version should be according to semver standards.

Types

This section is empty.

Jump to

Keyboard shortcuts

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