Skip to content

catouc/semver-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Reference Go Report Card

semver-go

"Get me the next patch, minor or major version of this git repository."

semver-go provides an interface to do that really easily without any dependencies for the cli. Currently this package does only support the patch, minor and major components of the semantic versioning spec.

This repository contains two things

  • The sem package that provides an interface for SemVer versioning
  • semver a cli that allows you to just get the next version easily from your command line or CI job shell

CLI Usage

semver will keep your version prefixes if you have any. It will then print out the next version to stdout.

# git repository with the latest tag v1.0.0
$ semver patch
v1.0.1

If you are facing issues with a few tags not being compliant with SemVer you can use the -i flag to ignore parsing errors.

# git repository with a tag like v.2.0.0 and a latest "real" tag like v1.0.0
$ semver -i patch
v1.0.1

Sem package usage

Find most of the detailed docs on pkg.go.dev.

The main exposed functions are

  • GetLatestVersion getting the latest version out of a git repository
  • The Ver struct that provides an interface to your version and the Next function that increments the version in place

Credits

  • mycrEEpy for developing this entire thing in tandem with me.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •