Skip to content

Commit

Permalink
fix(release): update version bump script to handle semver and include…
Browse files Browse the repository at this point in the history
… Cargo.lock
  • Loading branch information
trinhminhtriet committed Dec 2, 2024
1 parent b1b4d31 commit 6d2d44c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/release-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,25 @@ set -xe

current_version="$(grep '^version = ' Cargo.toml | head -1 | cut -d '"' -f2)"
new_version="$1"
semver=${new_version#v}

if [ -z "$new_version" ]; then
echo "New version required as argument"
exit 1
fi

echo ">>> Bumping version"
sed -i.bak "s/version = \"$current_version\"/version = \"$new_version\"/" Cargo.toml
sed -i.bak "s/version = \"$current_version\"/version = \"$semver\"/" Cargo.toml
rm Cargo.toml.bak

echo ">>> Running tests"
cargo build
cargo test

sleep 5

echo ">>> Commit"
git add Cargo.toml
git add Cargo.toml Cargo.lock
git commit -am "v$new_version"
git tag v$new_version

Expand Down

0 comments on commit 6d2d44c

Please sign in to comment.