Skip to content

Commit

Permalink
fix: set correct debian version during release (#770)
Browse files Browse the repository at this point in the history
* fix: set correct debian version during release

* fix: include ~pre in the pre-release version
  • Loading branch information
diogomatsubara authored Oct 17, 2024
1 parent 09546e6 commit 19e4a6c
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions ci/scripts/bump-and-tag.bash
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ function toml_set_in_place() {
mv "$tmp" "$1"
}

# Converts cmake version into a debian package version
function to_debian_version() {
v="${1}"
deb_rev="${2:-1}"
# check if version has tweak component
if [ $(echo ${v//[^.]} | wc -c) == 4 ]; then
if [ ${v:0-2} == ".0" ]; then
deb_v=$(echo "${v}" | sed 's/\(.*\)\.0/\1~dev/')
else
deb_v=$(echo "${v}" | sed 's/\(.*\)\./\1~pre\./')
fi
echo "${deb_v}-${deb_rev}"
else
echo "${v}"
fi
}

export GIT_AUTHOR_NAME=$git_user_name
export GIT_AUTHOR_EMAIL=$git_user_email
export GIT_COMMITTER_NAME=$git_user_name
Expand All @@ -35,8 +52,9 @@ printf '%s' "$version" > version.txt
# Propagate version change to Cargo.toml and Cargo.toml.in
cmake . -DZENOHC_BUILD_IN_SOURCE_TREE=TRUE -DCMAKE_BUILD_TYPE=Release
# Update Debian dependency of libzenohc-dev
toml_set_in_place Cargo.toml "package.metadata.deb.variants.libzenohc-dev.depends" "libzenohc (=$version)"
toml_set_in_place Cargo.toml.in "package.metadata.deb.variants.libzenohc-dev.depends" "libzenohc (=$version)"
debian_version=$(to_debian_version $version)
toml_set_in_place Cargo.toml "package.metadata.deb.variants.libzenohc-dev.depends" "libzenohc (=$debian_version)"
toml_set_in_place Cargo.toml.in "package.metadata.deb.variants.libzenohc-dev.depends" "libzenohc (=$debian_version)"

git commit version.txt Cargo.toml Cargo.toml.in Cargo.lock -m "chore: Bump version to $version"

Expand Down

0 comments on commit 19e4a6c

Please sign in to comment.