-
Notifications
You must be signed in to change notification settings - Fork 2
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
80c703a
commit 9b9107d
Showing
1 changed file
with
30 additions
and
0 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
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 |