https://github.com/craftypath/nextver
Version increments within your CI/CD pipeline. Works well with SemVer and CalVer.
https://github.com/craftypath/nextver
auto-increment automation ci devops semantic-versioning semver
Last synced: 4 months ago
JSON representation
Version increments within your CI/CD pipeline. Works well with SemVer and CalVer.
- Host: GitHub
- URL: https://github.com/craftypath/nextver
- Owner: craftypath
- License: apache-2.0
- Created: 2020-04-02T08:54:28.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2025-07-14T14:53:10.000Z (7 months ago)
- Last Synced: 2025-07-14T16:29:01.893Z (7 months ago)
- Topics: auto-increment, automation, ci, devops, semantic-versioning, semver
- Language: Go
- Homepage:
- Size: 195 KB
- Stars: 16
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nextver
## Features
- auto-increments major, minor, or patch version when set to `x`:
```
nextver -c 0.0.0 -p 0.x.0 # prints 0.1.0
nextver -c 0.1.0 -p 0.x.0 # prints 0.2.0
# ... and so on ...
```
- in case you don't know / care about higher position versions, use `?` to keep their current value:
```
nextver -c 1.2.0 -p '?.x.0' # prints 1.3.0
```
- bump versions explicitly, with the auto-increment being reset to `0`:
```
# time for 1.0.0
nextver -c 0.487.0 -p 1.x.0 # prints 1.0.0
nextver -c 1.0.0 -p 1.x.0 # prints 1.1.0
```
- add/keep/remove commonly used `v` prefix:
```
nextver -c 0.1.0 -p v0.x.0 # prints v0.2.0
nextver -c v0.2.0 -p v0.x.0 # prints v0.3.0
nextver -c v0.3.0 -p 0.x.0 # prints 0.4.0
```
- add/keep/remove pre-release and/or build info:
```
nextver -c 2.1.0 -p 2.x.0+abc # prints 2.2.0+abc
nextver -c 2.2.0+abc -p 2.x.0+abc # prints 2.3.0+abc
nextver -c 2.3.0+abc -p 2.x.0 # prints 2.4.0
```
## Usage
```console
$ nextver -h
nextver manages automatic semver versioning
Usage:
nextver [flags]
Flags:
-c, --current-version string the current version
-h, --help help for nextver
-p, --pattern string the versioning pattern
-v, --version version for nextver
```
## CI/CD Example
If your artifact should have major version `0`, but you also want to bump the minor version with each build:
```
currentVersion=$(git describe --abbrev=0)
nextVersion=$(nextver -c "$currentVersion" -p 0.x.0)
git tag "$nextVersion"
git push --tags
# ... use $nextVersion, e.g. to tag a docker image.
```