Skip to content

Commit

Permalink
add release scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
trinhminhtriet committed Nov 5, 2024
1 parent 80c703a commit 9b9107d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions scripts/release-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -xe

[ -z "$(git status --porcelain)" ] || (echo "dirty working directory" && exit 1)

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

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
rm Cargo.toml.bak

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

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

echo ">>> Publish"
cargo publish
git push
git push origin $new_version

0 comments on commit 9b9107d

Please sign in to comment.