Packages
prometheus
4.11.0
6.1.3
6.1.2
6.1.1
6.1.0
6.0.3
6.0.2
6.0.1
6.0.0
5.1.1
5.1.0
5.0.0
4.13.0
retired
4.12.0
4.11.0
4.10.0
4.9.1
4.9.0
4.8.2
4.8.1
4.8.0
4.6.0
4.5.0
4.4.1
4.4.0
4.3.0
4.2.2
4.2.0
4.1.0
4.0.1
4.0.0
3.5.1
3.5.0
3.4.6
3.4.5
3.4.4
3.4.3
3.4.2
3.4.1
3.4.0
3.3.2
3.3.1
3.3.0
3.2.3
3.2.2
3.2.1
3.1.1
3.1.0
3.0.1
3.0.0
3.0.0-rc1
3.0.0-alpha9
3.0.0-alpha8
3.0.0-alpha7
3.0.0-alpha6
3.0.0-alpha5
3.0.0-alpha4
3.0.0-alpha3
3.0.0-alpha2
3.0.0-alpha10
3.0.0-alpha1
2.2.0
2.1.0
2.0.0
1.7.0
1.6.0
1.5.0
1.0.2
1.0.1
1.0.0
0.2.0
0.1.3
0.1.2
0.1.1
0.1.0
Prometheus.io client in Erlang
Current section
Files
Jump to
Current section
Files
bin/increment-version
#!/bin/bash
# Based on https://github.com/fmahnke/shell-semver
# The MIT License (MIT)
# Copyright (c) 2014 Fritz Mahnke
# Increment a version string using Semantic Versioning (SemVer) terminology.
# Parse command line options.
while getopts ":Mmp" Option
do
case $Option in
M ) major=true;;
m ) minor=true;;
p ) patch=true;;
esac
done
shift $(($OPTIND - 1))
STAGED_COUNT=$(git diff --cached --numstat | wc -l)
UNSTAGED_COUNT=$(git diff --numstat | wc -l)
## TODO check we are on master
if [ $STAGED_COUNT -ne "0" ]; then
echo "you have staged changes. Aborting".
exit 1
fi
if [ $UNSTAGED_COUNT -ne "0" ]; then
echo "you have unstaged changes. Aborting".
exit 1
fi
version="$(erl -noshell -s init stop -eval "{ok, [{_,_,Props}]} = file:consult(\"src/prometheus.app.src\"), io:format(\"~s\", [proplists:get_value(vsn, Props)])")"
echo "Old version: ${version}"
# Build array from version string.
oa=( ${version//./ } )
a=( ${version//./ } )
# If version string is missing or has the wrong number of members, show usage message.
if [ ${#a[@]} -ne 3 ]
then
echo "usage: $(basename $0) [-Mmp] TAG_MESSAGE(optional)"
exit 1
fi
# Increment version numbers as requested.
if [ ! -z $major ]
then
((a[0]++))
a[1]=0
a[2]=0
fi
if [ ! -z $minor ]
then
((a[1]++))
a[2]=0
fi
if [ ! -z $patch ]
then
((a[2]++))
fi
new_version="${a[0]}.${a[1]}.${a[2]}"
echo "New version: ${new_version}"
sed -i s/\"${oa[0]}\.${oa[1]}\.${oa[2]}\"/\"${a[0]}\.${a[1]}\.${a[2]}\"/g src/prometheus.app.src
sed -i s/\"${oa[0]}\.${oa[1]}\.${oa[2]}\"/\"${a[0]}\.${a[1]}\.${a[2]}\"/g mix.exs
sed -i s/@version\ ${oa[0]}\.${oa[1]}\.${oa[2]}/@version\ ${a[0]}\.${a[1]}\.${a[2]}/g doc/overview.md
rebar3 edoc
git add mix.exs src/prometheus.app.src
git add README.md
git add doc
git commit -m "Bump to v${new_version}" --no-verify
TAG_MESSAGE=${1:-"New version: v${new_version}"}
git tag -a "v${new_version}" -m "${TAG_MESSAGE}"
git push origin master
git push origin "v${new_version}"