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.sh17
1 files changed, 17 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..b12ca77ba
--- /dev/null
+++ b/contrib/ci/jobs/2-deb-package/version.sh
@@ -0,0 +1,17 @@
1#!/bin/sh
2set -ex
3
4BRANCH=$(git name-rev --name-only HEAD)
5if [ -z "${BRANCH}" ]; then
6 exit 1
7else
8 # "Unshallow" our checkout, but only our current branch, and exclude the submodules.
9 git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}"
10 RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-*dev*' --always --abbrev=0 HEAD || exit 1)
11 commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
12 if [ "${commits}" = "0" ]; then
13 git describe --tag HEAD | sed -r 's/^v//' || exit 1
14 else
15 echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD)
16 fi
17fi