Skip to content

Commit

Permalink
Merge branch 'ci-package-repo' into 'main'
Browse files Browse the repository at this point in the history
ci/pkg: fix handing of git-describe version for deb and rpm

See merge request xen-project/xen-guest-agent!42
  • Loading branch information
ydirson committed Dec 14, 2023
2 parents d9698d6 + ad5e20c commit 40f8cc5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ env-setup:
case "$CI_COMMIT_REF_NAME" in
main) UPSTREAMVERSION=$(git describe)
TILDEVERSION=$UPSTREAMVERSION
RPMVERSION=$(echo $UPSTREAMVERSION | tr "-" "+")
;;
*) UPSTREAMVERSION=$(grep "^version =" Cargo.toml | cut -d\" -f2)
# both DEB and RPM use "~" to sort pre-releases before releases
TILDEVERSION=$(echo $UPSTREAMVERSION | tr "-" "~")
RPMVERSION=$TILDEVERSION
;;
esac
# update channel must be the same for matching packaging and deploy
Expand All @@ -118,6 +120,7 @@ env-setup:
- echo "UPDATE_CHANNEL=${UPDATE_CHANNEL}" > version.env
- echo "UPSTREAMVERSION=${UPSTREAMVERSION}" >> version.env
- echo "TILDEVERSION=${TILDEVERSION}" >> version.env
- echo "RPMVERSION=${RPMVERSION}" >> version.env

- cat version.env

Expand Down Expand Up @@ -243,7 +246,12 @@ pkg-deb-amd64:

# mangle names to avoid chars rejected by the gitlab package registry,
# see https://gitlab.com/gitlab-org/gitlab/-/issues/413517
- for FILE in *.deb; do mv $FILE $(echo $FILE | tr "~" "-"); done
- |
if [ "${UPSTREAMVERSION}" != "${TILDEVERSION}" ]; then
for FILE in *.deb; do
mv $FILE $(echo $FILE | tr "~" "-")
done
fi
- apt-ftparchive generate ../../apt-ftparchive.conf

Expand Down Expand Up @@ -298,7 +306,7 @@ pkg-rpm-x86_64:
- >-
sed < xen-guest-agent.spec.in > xen-guest-agent.spec
-e "s/@@UPSTREAMVERSION@@/$UPSTREAMVERSION/"
-e "s/@@VERSION@@/$TILDEVERSION/"
-e "s/@@VERSION@@/$RPMVERSION/"
-e "s/@@AUTHOR@@/$GITLAB_USER_NAME <$GITLAB_USER_EMAIL>/"
-e "s/@@DATE@@/$(date +'%a %b %d %Y')/"
- dnf builddep xen-guest-agent.spec -y
Expand Down

0 comments on commit 40f8cc5

Please sign in to comment.