aboutsummaryrefslogtreecommitdiff
path: root/contrib/ci/jobs/2-deb-package/version.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ci/jobs/2-deb-package/version.sh')
-rwxr-xr-xcontrib/ci/jobs/2-deb-package/version.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/ci/jobs/2-deb-package/version.sh b/contrib/ci/jobs/2-deb-package/version.sh
new file mode 100755
index 000000000..74d0099a2
--- /dev/null
+++ b/contrib/ci/jobs/2-deb-package/version.sh
@@ -0,0 +1,12 @@
1#!/bin/sh
2set -ex
3
4git fetch origin $(git rev-parse --abbrev-ref HEAD) --depth=1000 --tags
5RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --always --abbrev=0 HEAD)
6
7commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
8if [ "${commits}" = "0" ]; then
9 git describe --tag HEAD
10else
11 echo $(echo ${RECENT_VERSION_TAG} | cut -d'v' -f2)-${commits}-$(git rev-parse --short=8 HEAD)
12fi