Coder Social home page Coder Social logo

gump's Introduction

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 :

  • prebump : Runs in first for any type of update, it does not receive !newversion! tag. It should be used to synchronize your local with remote.
  • prepatch : Runs for a patch update.
  • preminor : Runs for a minor update.
  • premajor : Runs for a major update.
  • preversion : Runs for a any type of update.
  • version is set here on your vcs
  • postversion : Runs for a any type of update.
  • postmajor : Runs for a major update.
  • postminor : Runs for a minor update.
  • postpatch : Runs for a patch update.
  • postbump : Runs for a any type of update.

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

  • !newversion! will be replaced by the value of the new version (not available in prebump)
  • !tagmessage! will be replaced by the value of the tag message
  • !isprerelease! will be replaced by yes when --beta or --alpha arguments are present, otherwise it is replaced by the value no
  • !isprerelease_int! will be replaced by 1 when --beta or --alpha arguments are present, otherwise it is replaced by the value 0
  • !isprerelease_bool! will be replaced by true when --beta or --alpha arguments are present, otherwise it is replaced by the value false

.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

gump's People

Contributors

mh-cbon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gump's Issues

.version.sh for linux. How about on windows?

Suggest OS detection and looking for .version.bat when Windows is detected. Obviously, it's undesirable to have to maintain logic in two separate files, but I don't see a way around it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.