-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2bb7b16
commit f6a73c0
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
# Project version | ||
readonly VERSION | ||
# Zenoh dependencies' version | ||
readonly ZENOH_VERSION | ||
# Zenoh dependencies' git branch | ||
readonly ZENOH_BRANCH | ||
|
||
cargo +stable install toml-cli | ||
|
||
# NOTE(fuzzypixelz): toml-cli doesn't yet support in-place modification | ||
# See: https://github.com/gnprice/toml-cli?tab=readme-ov-file#writing-ish-toml-set | ||
function toml_set_in_place() { | ||
local tmp=$(mktemp) | ||
toml set "$1" "$2" "$3" > "$tmp" | ||
mv "$tmp" "$1" | ||
} | ||
|
||
# Bump CMake project version | ||
sed -i "s;^set(ZENOHC_VERSION .*)$;set(ZENOHC_VERSION $VERSION);" CMakeLists.txt | ||
# Propagate version change to Cargo.toml and Cargo.toml.in | ||
cmake . -DZENOHC_BUILD_IN_SOURCE_TREE=TRUE -DCMAKE_BUILD_TYPE=Release | ||
|
||
git commit CMakeLists.txt Cargo.toml Cargo.lock -m "chore: Bump version to $VERSION" | ||
|
||
# Select all package dependencies that match 'zenoh.*' and bump them to $ZENOH_VERSION | ||
zenoh_deps=$(toml get Cargo.toml dependencies | jq -r 'keys.[] | select(test("zenoh.*"))') | ||
for dep in $zenoh_deps; do | ||
[[ -n $ZENOH_VERSION ]] && toml_set_in_place Cargo.toml "dependencies.$dep.version" "$ZENOH_VERSION" | ||
[[ -n $ZENOH_BRANCH ]] && toml_set_in_place Cargo.toml "dependencies.$dep.branch" "$ZENOH_BRANCH" | ||
done | ||
# Update lockfile | ||
cargo check | ||
|
||
if [[ -n $ZENOH_VERSION || -n $ZENOH_BRANCH ]]; then | ||
git commit Cargo.toml Cargo.lock -m "chore: Bump Zenoh version to $ZENOH_VERSION" | ||
else | ||
echo "info: no changes have been made to Zenoh dependencies" | ||
fi |