1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

Added bumpversion

This commit is contained in:
Javier Cortejoso 2019-04-08 17:33:38 +02:00
parent 7eeb4e3342
commit e0a62b1a42
No known key found for this signature in database
GPG Key ID: FBEEF3131E39EBCF
2 changed files with 43 additions and 0 deletions

7
.bumpversion.cfg Normal file
View File

@ -0,0 +1,7 @@
[bumpversion]
current_version = 0.1.1
[bumpversion:file:package.json]
search = "version": "{current_version}",
replace = "version": "{new_version}",

36
bumpversion.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
set -x
set -e
usage(){
echo "Usage: $0 {major|minor|patch} [--tag]"
exit 1
}
if ! [ -x "$(command -v bumpversion)" ]; then
echo 'Error: bumpversion is not installed.' >&2
exit 1
elif ! git diff-index --quiet HEAD -- >/dev/null 2>&1; then
echo 'There are local changes in your the git repository. Please commit or stash them before bumping version.' >&2
exit 1
fi
if [ "$#" -lt 1 ]; then
echo "Illegal number of parameters"
usage
elif [[ $1 != 'major' && $1 != 'minor' && $1 != 'patch' ]]; then
echo 'First argument must be {major|minor|patch}'
usage
fi
if [[ $2 == '--tag' ]]; then
if git branch --contains $(git rev-parse --verify HEAD) | grep -E 'master'; then
bumpversion --tag --commit $1
else
echo "Only master tags can be tagged"
exit 1
fi
else
bumpversion $1
fi