fix: change version format

LIBRETIME_VERSION is now:
- the tag name for a tagged version
- the head ref name and commit sha for untagged versions (main branch and pull requests)
This commit is contained in:
jo 2022-09-26 13:08:39 +02:00 committed by Kyle Robbertze
parent 09a75570f3
commit a6f0642f71
1 changed files with 3 additions and 3 deletions

View File

@ -15,9 +15,9 @@ typeset -r version_file="VERSION"
if [[ "$(git rev-parse --is-inside-work-tree 2> /dev/null)" == "true" ]]; then
tag=$(git tag --points-at HEAD | tee "$version_file" || error "could not extract tag")
if [[ -z "$tag" ]]; then
latest_tag=$(git describe --abbrev=0 --tags || error "could not extract latest tag")
latest_commit=$(git rev-parse --short HEAD || error "could not extract commit sha")
echo "$latest_tag-dev+$latest_commit" > "$version_file"
ref="${GITHUB_REF_NAME:-$(git rev-parse --abbrev-ref HEAD || error "could not extract ref")}"
sha="${GITHUB_SHA:-$(git rev-parse HEAD || error "could not extract commit sha")}"
echo "$ref-$sha" > "$version_file"
fi
else
if [[ ! -f "$version_file" ]]; then