From 5d8084daa7812931b53d65312b2cebf9a8453e49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Mon, 9 May 2022 14:52:03 -0500 Subject: add flag to print version and exit --- generate-version.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 generate-version.sh (limited to 'generate-version.sh') 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 -- cgit v1.2.3