diff options
author | EuAndreh <eu@euandre.org> | 2018-10-16 12:53:52 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2018-10-16 12:53:52 -0300 |
commit | 5efe4d78aa79bd6c079fb32d1db004e5a45aeb07 (patch) | |
tree | 054705955d2e6139d5c836cebc0e2922a2ca9dd2 | |
parent | Use latest unstable version of nodejs 10. (diff) | |
download | dotfiles-5efe4d78aa79bd6c079fb32d1db004e5a45aeb07.tar.gz dotfiles-5efe4d78aa79bd6c079fb32d1db004e5a45aeb07.tar.xz |
Add autobump script sample.
-rwxr-xr-x | scripts/bump.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/bump.sh b/scripts/bump.sh new file mode 100755 index 0000000..86eed54 --- /dev/null +++ b/scripts/bump.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +function latest_version() { + git tag | sort -V | tail -n 1 +} + +function overflow_bump() { + IFS=".$IFS" + read a b c + if [[ "$b" == 999 ]]; then + echo $((a + 1)).0.0 + elif [[ "$c" == 999 ]]; then + echo $a.$((b + 1)).0 + else + echo $a.$b.$((c + 1)) + fi +} + +latest_version | overflow_bump + +echo "$1" | overflow_bump |