Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 7 days ago
JSON representation

Version increments within your CI/CD pipeline. Works well with SemVer and CalVer.

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.
```