github.com/secure-build/gitlab-runner@v12.5.0+incompatible/ci/version (about) 1 #!/usr/bin/env bash 2 3 set -eo pipefail 4 5 version=$(cat VERSION || echo dev | sed -e 's/^v//g') 6 exact_tag=$(git describe --exact-match 2>/dev/null | sed -e 's/^v//g' || echo "") 7 8 if [[ $(echo ${exact_tag} | grep -E "^[0-9]+\.[0-9]+\.[0-9]+$") ]]; then 9 echo $exact_tag 10 exit 0 11 fi 12 13 if [[ $(echo ${exact_tag} | grep -E "^[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+$") ]]; then 14 echo $exact_tag 15 exit 0 16 fi 17 18 last_tag=$(git log --first-parent --pretty="%d" | grep -E "tag: v[0-9]+\.[0-9]+\.[0-9]+(\)|,)" -o | grep "v[0-9]*\.[0-9]*\.[0-9]*" -o | head -n 1) 19 commits=$(git log --oneline ${last_tag}..HEAD | wc -l | tr -d ' ') 20 revision=$(git rev-parse --short=8 HEAD || echo unknown) 21 22 echo "${version}~beta.${commits}.g${revision}"