summaryrefslogtreecommitdiff
path: root/generate-version.sh
diff options
context:
space:
mode:
Diffstat (limited to 'generate-version.sh')
-rwxr-xr-xgenerate-version.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/generate-version.sh b/generate-version.sh
new file mode 100755
index 0000000..cf408e1
--- /dev/null
+++ b/generate-version.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if git tag --contains HEAD | grep -q $1; then
+ echo $1
+else
+ branch="$(git rev-parse --abbrev-ref HEAD)"
+ commit="$(git rev-parse --short HEAD)"
+ if [ "${branch}" != "main" ]; then
+ echo $1-$branch-$commit
+ else
+ echo $1-$commit
+ fi
+fi