Home

Awesome

gump

travis StatusAppveyor StatusGo Report CardGoDoc

Gump is an utility to bump your package using semver.

This tool is part of the go-github-release workflow

TOC

Install

Check the release page!

Glide

mkdir -p $GOPATH/src/github.com/mh-cbon/gump
cd $GOPATH/src/github.com/mh-cbon/gump
git clone https://github.com/mh-cbon/gump.git .
glide install
go install

Bintray

choco source add -n=mh-cbon -s="https://api.bintray.com/nuget/mh-cbon/choco"
choco install gump

Chocolatey

choco install gump

linux rpm/deb repository

wget -O - https://raw.githubusercontent.com/mh-cbon/latest/master/bintray.sh \
| GH=mh-cbon/gump sh -xe
# or
curl -L https://raw.githubusercontent.com/mh-cbon/latest/master/bintray.sh \
| GH=mh-cbon/gump sh -xe

linux rpm/deb standalone package

curl -L https://raw.githubusercontent.com/mh-cbon/latest/master/install.sh \
| GH=mh-cbon/gump sh -xe
# or
wget -q -O - --no-check-certificate \
https://raw.githubusercontent.com/mh-cbon/latest/master/install.sh \
| GH=mh-cbon/gump sh -xe

Cli

gump -help

Gump - Bump your package

Usage:
  gump prerelease [-b|--beta] [-a|--alpha] [-d|--dry] [-m <message>]
  gump patch [-d|--dry] [-m <message>]
  gump minor [-d|--dry] [-m <message>]
  gump major [-d|--dry] [-m <message>]
  gump -h | --help
  gump -v | --version

Options:
  -h --help             Show this screen.
  -v --version          Show version.
  -d --dry              Only display the new version number.
  -b --beta             Update last beta version.
  -a --alpha            Update last alpha version.
  -m                    Set tag message.

Examples
  # Bump patch with a message
  gump patch -m "tag message"
  # Bump major with a message
  gump major -m "tag message"

Examples

gump patch -d
gump prerelease -a -d
gump prerelease -b -d
gump minor -d
gump major -d

Bump script

Pre/Post version scripts

Gump can detect, parse and execute pre/post version scripts.

The file is written to be compatible for both linux and windows.

They are numerous hooks executed in this order :

If any pre script returns an exit code different than 0, the execution will stop and the version will remain untouched.

If post script fails, the version has already changed, gump will return an exit code = 1.

Scripts can use few special tags

.version.sh

Drop a file named .version.sh on your root such

.version.sh

PREBUMP=
  666 git fetch --tags origin master
  666 git pull origin master

PREVERSION=
  philea -s "666 go vet %s" "666 go-fmt-fail %s"
  666 go run gump.go -v
  666 go test
  666 go test config/*
  666 go test stringexec/*
  666 changelog finalize --version !newversion!
  666 commit -q -m "changelog: !newversion!" -f change.log

POSTVERSION=
  666 changelog md -o CHANGELOG.md --guess
  666 commit -q -m "changelog: !newversion!" -f CHANGELOG.md
  666 go install --ldflags "-X main.VERSION=!newversion!"
  666 emd gen -out README.md
  666 commit -q -m "README: !newversion!" -f README.md
  666 git push
  666 git push --tags
  666 gh-api-cli create-release -n release -o mh-cbon --guess \
   --ver !newversion! -c "changelog ghrelease --version !newversion!" \
  --draft !isprerelease!

.version

Drop a file named .version on your root such

.version-demo

# demo of .version file
prebump: git fetch --tags
preversion: go vet && go fmt
postversion: git push && git push --tags

glide.yaml

Add a new key scripts to your glide file such

demo-glide.yaml

package: github.com/mh-cbon/gump
scripts:
  prebump: echo "pre bump"
  postbump: echo "post bump"
import:
- package: gopkg.in/yaml.v2

If you have longer scripts to run you can write it like this:

demo-long-glide.yaml

scripts:
  preversion: |
    echo "hello" \
    && echo "how are you ?"
  postversion: |
    echo "I m fine"
    && echo "goodbye"

Recipes

debug

Declare a new env VERBOSE=gump or VERBOSE=* to get more information.

VERBOSE=gump gump patch -d
VERBOSE=* gump patch -d

Release the project

gump patch -d # check
gump patch # bump

History

CHANGELOG

Todos