From a6f0642f71aeeab6017fea791f4cd118897916dc Mon Sep 17 00:00:00 2001 From: jo Date: Mon, 26 Sep 2022 13:08:39 +0200 Subject: [PATCH] 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) --- tools/version.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/version.sh b/tools/version.sh index 4d60d732c..8818f68b7 100755 --- a/tools/version.sh +++ b/tools/version.sh @@ -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