2022-10-22 04:01:12 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
package=$1
|
|
|
|
tag_prefix=$2
|
2022-10-26 21:29:47 +03:00
|
|
|
tag_suffix=$3
|
|
|
|
version_increment=$4
|
2022-10-22 04:01:12 +03:00
|
|
|
|
|
|
|
if [[ -n $(git status --short --untracked-files=no) ]]; then
|
2022-10-27 22:00:45 +03:00
|
|
|
echo "can't bump version with uncommitted changes"
|
2022-10-22 04:01:12 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-08-19 01:52:21 +03:00
|
|
|
which cargo-set-version > /dev/null || cargo install cargo-edit --features vendored-openssl
|
2022-11-19 00:42:46 +03:00
|
|
|
which jq > /dev/null || brew install jq
|
2022-10-22 04:01:12 +03:00
|
|
|
cargo set-version --package $package --bump $version_increment
|
|
|
|
cargo check --quiet
|
|
|
|
|
2022-10-26 22:19:49 +03:00
|
|
|
new_version=$(script/get-crate-version $package)
|
2022-10-22 04:01:12 +03:00
|
|
|
branch_name=$(git rev-parse --abbrev-ref HEAD)
|
|
|
|
old_sha=$(git rev-parse HEAD)
|
2022-10-26 21:29:47 +03:00
|
|
|
tag_name=${tag_prefix}${new_version}${tag_suffix}
|
2022-10-22 04:01:12 +03:00
|
|
|
|
|
|
|
git commit --quiet --all --message "${package} ${new_version}"
|
|
|
|
git tag ${tag_name}
|
|
|
|
|
|
|
|
cat <<MESSAGE
|
2022-10-26 21:29:47 +03:00
|
|
|
Locally committed and tagged ${package} version ${new_version}
|
2022-10-22 04:01:12 +03:00
|
|
|
|
|
|
|
To push this:
|
2022-10-28 01:33:49 +03:00
|
|
|
|
2024-01-09 01:49:03 +03:00
|
|
|
git push origin ${branch_name} ${tag_name}
|
2022-10-22 04:01:12 +03:00
|
|
|
|
|
|
|
To undo this:
|
2022-10-28 01:33:49 +03:00
|
|
|
|
2022-10-27 22:00:45 +03:00
|
|
|
git reset --hard ${old_sha} && git tag -d ${tag_name}
|
2022-10-28 01:33:49 +03:00
|
|
|
|
2022-10-22 04:01:12 +03:00
|
|
|
MESSAGE
|