diff options
Diffstat (limited to 'contrib/ci/jobs/5-arm64-deb-package/version.sh')
-rwxr-xr-x | contrib/ci/jobs/5-arm64-deb-package/version.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/ci/jobs/5-arm64-deb-package/version.sh b/contrib/ci/jobs/5-arm64-deb-package/version.sh new file mode 100755 index 000000000..b12ca77ba --- /dev/null +++ b/contrib/ci/jobs/5-arm64-deb-package/version.sh | |||
@@ -0,0 +1,17 @@ | |||
1 | #!/bin/sh | ||
2 | set -ex | ||
3 | |||
4 | BRANCH=$(git name-rev --name-only HEAD) | ||
5 | if [ -z "${BRANCH}" ]; then | ||
6 | exit 1 | ||
7 | else | ||
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 | ||
17 | fi | ||