forked from eclipse-zenoh/zenoh-python
-
Notifications
You must be signed in to change notification settings - Fork 0
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
ef5df8e
commit 7823c22
Showing
2 changed files
with
95 additions
and
10 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
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,66 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -xeo pipefail | ||
|
||
# Release number | ||
readonly version=${VERSION:?input VERSION is required} | ||
# Dependencies' pattern | ||
readonly bump_deps_pattern=${BUMP_DEPS_PATTERN:-''} | ||
# Dependencies' version | ||
readonly bump_deps_version=${BUMP_DEPS_VERSION:-''} | ||
# Dependencies' git branch | ||
readonly bump_deps_branch=${BUMP_DEPS_BRANCH:-''} | ||
# Git actor name | ||
readonly git_user_name=${GIT_USER_NAME:?input GIT_USER_NAME is required} | ||
# Git actor email | ||
readonly git_user_email=${GIT_USER_EMAIL:?input GIT_USER_EMAIL is required} | ||
|
||
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" | ||
} | ||
|
||
export GIT_AUTHOR_NAME=$git_user_name | ||
export GIT_AUTHOR_EMAIL=$git_user_email | ||
export GIT_COMMITTER_NAME=$git_user_name | ||
export GIT_COMMITTER_EMAIL=$git_user_email | ||
|
||
# Bump Cargo version | ||
toml_set_in_place Cargo.toml "package.version" "$version" | ||
# Propagate version change to pyproject.toml | ||
toml_set_in_place pyproject.toml "project.version" "$version" | ||
|
||
git commit version.txt Cargo.toml pyproject.toml -m "chore: Bump version to $version" | ||
|
||
# Select all package dependencies that match $bump_deps_pattern and bump them to $bump_deps_version | ||
if [[ "$bump_deps_pattern" != '' ]]; then | ||
deps=$(toml get Cargo.toml dependencies | jq -r "keys.[] | select(test(\"$bump_deps_pattern\"))") | ||
for dep in $deps; do | ||
if [[ -n $bump_deps_version ]]; then | ||
toml_set_in_place Cargo.toml "dependencies.$dep.version" "$bump_deps_version" | ||
fi | ||
|
||
if [[ -n $bump_deps_branch ]]; then | ||
toml_set_in_place Cargo.toml "dependencies.$dep.branch" "$bump_deps_branch" | ||
fi | ||
done | ||
# Update lockfile | ||
cargo check | ||
|
||
if [[ -n $bump_deps_version || -n $bump_deps_branch ]]; then | ||
git commit Cargo.toml Cargo.lock -m "chore: Bump $bump_deps_pattern version to $bump_deps_version" | ||
else | ||
echo "warn: no changes have been made to any dependencies matching $bump_deps_pattern" | ||
fi | ||
fi | ||
|
||
git tag --force "$version" -m "v$version" | ||
git log -10 | ||
git show-ref --tags | ||
git push origin | ||
git push --force origin "$version" |