From: Yann Dirson Date: Thu, 14 Dec 2023 10:37:47 +0000 (+0100) Subject: ci: use git-describe to set version for main branch builds X-Git-Tag: 0.3.0~5^2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e651f8fae5c49bb1301a9b38fb047eba78d941dc;p=xen-guest-agent.git ci: use git-describe to set version for main branch builds This will ensure not all builds share the same version string, and let package update mechanism do their job. Signed-off-by: Yann Dirson --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 934cbb5..dfb8eeb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -91,9 +91,16 @@ env-setup: stage: setup image: alpine:latest script: - - 'UPSTREAMVERSION=$(grep "^version =" Cargo.toml | cut -d\" -f2)' - # both DEB and RPM use "~" to sort pre-releases before releases - - 'TILDEVERSION=$(echo $UPSTREAMVERSION | tr "-" "~")' + - | + case "$CI_COMMIT_BRANCH" in + main) UPSTREAMVERSION=$(git describe) + TILDEVERSION=$UPSTREAMVERSION + ;; + *) UPSTREAMVERSION=$(grep "^version =" Cargo.toml | cut -d\" -f2) + # both DEB and RPM use "~" to sort pre-releases before releases + TILDEVERSION=$(echo $UPSTREAMVERSION | tr "-" "~") + ;; + esac # update channel must be the same for matching packaging and deploy # jobs, set it once globally - |