From: Yann Dirson Date: Thu, 14 Dec 2023 10:32:15 +0000 (+0100) Subject: ci: set VERSION and UPSTREAMVERSION once in env-setup X-Git-Tag: 0.3.0~5^2~2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9d9d2cf29d895635a8670bd4955d09e24f8cda1a;p=xen-guest-agent.git ci: set VERSION and UPSTREAMVERSION once in env-setup Similarly to UPDATE_CHANNEL, we want a more complex heuristic to set it in the end. Signed-off-by: Yann Dirson --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c17bfab..ceb9778 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -91,6 +91,9 @@ 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 + - 'VERSION=$(echo $UPSTREAMVERSION | tr "-" "~")' # update channel must be the same for matching packaging and deploy # jobs, set it once globally - | @@ -99,7 +102,10 @@ env-setup: *-*) UPDATE_CHANNEL="testing" ;; *) UPDATE_CHANNEL="release" ;; esac + - echo "UPDATE_CHANNEL=${UPDATE_CHANNEL}" > version.env + - echo "UPSTREAMVERSION=${UPSTREAMVERSION}" >> version.env + - echo "VERSION=${VERSION}" >> version.env - cat version.env @@ -211,7 +217,6 @@ pkg-deb-amd64: - apt update - apt install -y build-essential debhelper apt-utils - dpkg-checkbuilddeps - - 'VERSION=$(grep "^version =" Cargo.toml | cut -d\" -f2 | tr "-" "~")' script: - >- sed < debian/changelog.in > debian/changelog @@ -271,14 +276,13 @@ pkg-rpm-x86_64: extends: - .not-scheduled needs: + - env-setup - build-release-linux-x86_64 before_script: - dnf install -y rpm-build dnf-utils - mkdir SOURCES - ln -sr target/release/xen-guest-agent SOURCES/ - ln -sr startup/xen-guest-agent.service SOURCES/ - - 'UPSTREAMVERSION=$(grep "^version =" Cargo.toml | cut -d\" -f2)' - - 'VERSION=$(echo $UPSTREAMVERSION | tr "-" "~")' - >- sed < xen-guest-agent.spec.in > xen-guest-agent.spec -e "s/@@UPSTREAMVERSION@@/$UPSTREAMVERSION/"