From 5efe4d78aa79bd6c079fb32d1db004e5a45aeb07 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 16 Oct 2018 12:53:52 -0300 Subject: Add autobump script sample. --- scripts/bump.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 scripts/bump.sh (limited to 'scripts') 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 -- cgit v1.2.3