aboutsummaryrefslogtreecommitdiff
path: root/contrib/ci/jobs/111-deb-package-debian-trixie-amd64-generated/version.sh
diff options
context:
space:
mode:
authorNullptrderef <nullptrderef@proton.me>2024-06-16 13:56:11 +0200
committerNullptrderef <nullptrderef@proton.me>2024-06-16 13:56:11 +0200
commit3cbfa7ab59d37b53724c15fed55a4880745db6a6 (patch)
treecf0e9b5ad27b04be38bf63f9d8092bec1d122ad5 /contrib/ci/jobs/111-deb-package-debian-trixie-amd64-generated/version.sh
parentea28f2d34f308f812076e0128b1799acf8c686dd (diff)
generate ci targets
Diffstat (limited to 'contrib/ci/jobs/111-deb-package-debian-trixie-amd64-generated/version.sh')
-rwxr-xr-xcontrib/ci/jobs/111-deb-package-debian-trixie-amd64-generated/version.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/ci/jobs/111-deb-package-debian-trixie-amd64-generated/version.sh b/contrib/ci/jobs/111-deb-package-debian-trixie-amd64-generated/version.sh
new file mode 100755
index 000000000..52031b23a
--- /dev/null
+++ b/contrib/ci/jobs/111-deb-package-debian-trixie-amd64-generated/version.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+set -ex
+
+BRANCH=$(git name-rev --name-only HEAD)
+if [ -z "${BRANCH}" ]; then
+ exit 1
+else
+ # "Unshallow" our checkout, but only our current branch, and exclude the submodules.
+ git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}"
+ RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-dev*' --always --abbrev=0 HEAD || exit 1)
+ commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
+ if [ "${commits}" = "0" ]; then
+ git describe --tag HEAD | sed -r 's/^v//' || exit 1
+ else
+ echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD)
+ fi
+fi