Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-679: Create a script for bumping version #242

Merged
merged 17 commits into from
Mar 20, 2023
Merged
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions ci/bump_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash -xv

if [ $# != 1 ]
then
echo "Please provide version as the first argument"
exit 1
fi

version=$1
utkarshg6 marked this conversation as resolved.
Show resolved Hide resolved
CI_DIR="$( cd "$( dirname "$0" )" && pwd )"
file=Cargo.toml
final_exit_code=0

declare -a crates=(
utkarshg6 marked this conversation as resolved.
Show resolved Hide resolved
"automap"
"dns_utility"
"masq"
"masq_lib"
"multinode_integration_tests"
"node"
"port_exposer"
)
declare -a failed_crates

bump_version() {
pushd "$CI_DIR/../$1"

utkarshg6 marked this conversation as resolved.
Show resolved Hide resolved
sed -i '3s/version = .*/version = "'"$version"'"/' $file
utkarshg6 marked this conversation as resolved.
Show resolved Hide resolved
cargo generate-lockfile
exit_code="$?"
if [[ "$exit_code" != "0" ]]; then
final_exit_code=1
failed_crates+=($1)
fi

popd
}

for crate in "${crates[@]}"
do
:
utkarshg6 marked this conversation as resolved.
Show resolved Hide resolved
bump_version "$crate"
done

if [[ "${#failed_crates[@]}" != "0" ]]; then
echo "Failed to generate lockfile for ${#failed_crates[@]} crates: ${failed_crates[*]}"
else
echo "The version number has been changed to $1."
fi

exit $final_exit_code