diff options
Diffstat (limited to 'contrib/ci/jobs/2-deb-package/version.sh')
-rwxr-xr-x | contrib/ci/jobs/2-deb-package/version.sh | 12 |
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 | ||
2 | set -ex | ||
3 | |||
4 | git fetch origin $(git rev-parse --abbrev-ref HEAD) --depth=1000 --tags | ||
5 | RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --always --abbrev=0 HEAD) | ||
6 | |||
7 | commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)" | ||
8 | if [ "${commits}" = "0" ]; then | ||
9 | git describe --tag HEAD | ||
10 | else | ||
11 | echo $(echo ${RECENT_VERSION_TAG} | cut -d'v' -f2)-${commits}-$(git rev-parse --short=8 HEAD) | ||
12 | fi | ||