foliea / nextver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Table of Contents generated with DocToc

This application calculates the next version from the git history. It detects commit kinds using the "conventional commits" specification

Build

go mod download
go test ./...
go build

Usage

usage: nextver [<flags>] <command> [<args> ...]

Flags:
      --help               Show context-sensitive help (also try --help-long and --help-man).
  -p, --pattern="vSEMVER"  Versionning pattern
  -o, --output="console"   Output format (console, json, yaml)
  -b, --branch=BRANCH      Target branch (default branch if empty)
      --log-level="info"   Log level
      --provider="local"   provider
      --color              Colorize output

Commands:
  help [<command>...]
    Show help.

  get releases --github-token=GITHUB-TOKEN --github-owner=GITHUB-OWNER --github-repo=GITHUB-REPO
    List releases

  get changelog --github-token=GITHUB-TOKEN --github-owner=GITHUB-OWNER --github-repo=GITHUB-REPO
    Get changelog

  get next-version --github-token=GITHUB-TOKEN --github-owner=GITHUB-OWNER --github-repo=GITHUB-REPO
    Get next version

Authentication

Create a Github access token with at least the following scopes: github_scope

Then use this token using the option

nextver --github-token=xxxxxxxxx ...

or exporting the environment variable

export GITHUB_TOKEN=xxxxxxxxx

Release pattern

The following keyworks are supported

  • SEMVER: use semantic versionning (ex 1.0.5)
  • DATE: use timestamping for rolling versionning. The opiniated format is YYYY-MM-DD-HHmmss

Those keywords can be used in any pattern. Some examples:

SEMVER        -> 1.0.5
vSEMVER       -> v1.0.5
rDATE         -> r2019-04-01-133742
DATE          -> 2019-04-01-133742
release-DATE  -> release-2019-04-01-133742

Default options

SEMVER (vSEMVER) is the default release pattern

$ nextver get next-version --github-owner=tauffredou --github-repo=test-semver
v1.0.0

Getting details

$ nextver get changelog --github-owner=tauffredou --github-repo=test-semver 
Current release version : 0.0.0
Next release version    : v1.0.0

Changelog:
 Date           │ Author           │ Kind    │ Level │ Scope │ Title        
 ━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━┿━━━━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━━━━━━━━━
 19/03/30 12:44 │ Thomas Auffredou │ chore   │ MAJOR │ test2 │ some change  
 19/03/30 12:29 │ Thomas Auffredou │ feat    │ MINOR │ test  │ super feature
 19/03/30 11:53 │ Thomas Auffredou │ initial │       │       │ commit       

Using date release

$ nextver get next-version --github-owner=tauffredou --github-repo=test-semver --pattern=myprefix-DATE
myprefix-2019-05-01-110159

The DATE pattern uses only time, ignoring the semantic versionning and the conventional commit convensions.

Current release version : 0.0.0
Next release version    : myprefix-2019-05-01-111206

Changelog:
 Date           │ Author           │ Kind    │ Level │ Scope │ Title        
 ━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━┿━━━━━━━━━┿━━━━━━━┿━━━━━━━┿━━━━━━━━━━━━━━
 19/03/30 12:44 │ Thomas Auffredou │ chore   │ MAJOR │ test2 │ some change  
 19/03/30 12:29 │ Thomas Auffredou │ feat    │ MINOR │ test  │ super feature
 19/03/30 11:53 │ Thomas Auffredou │ initial │       │       │ commit  

About


Languages

Language:Go 95.1%Language:Shell 2.8%Language:Dockerfile 1.5%Language:Makefile 0.6%