aboutsummaryrefslogtreecommitdiff
path: root/scripts/bump.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/bump.sh')
-rwxr-xr-xscripts/bump.sh21
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