-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Showing
1 changed file
with
33 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,33 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
cd "$(dirname "$0")" | ||
|
||
function get_version() { | ||
cargo metadata --format-version=1 --no-deps --locked \ | ||
| jq -r '.packages[].version' | ||
} | ||
|
||
if [ -n "$(git status --untracked-files=no --porcelain)" ]; then | ||
echo "Your working directory is not clean" | ||
exit 1 | ||
fi | ||
|
||
echo "Current Version:" $(get_version) | ||
printf "New Version: " | ||
read version0 | ||
version="$(echo "$version0" | tr -d '[:blank:]')" | ||
sed -E -e '/^\[package\]$/,/^\[/ {/version =/ {s/"[^"]*"/"'"$version"'"/; :a;n;ba}}' \ | ||
-i Cargo.toml | ||
|
||
if [ "$(get_version)" != "$version" ]; then | ||
echo "Failed to set version" | ||
exit 1 | ||
fi | ||
|
||
cargo update -p cargo-doc2readme | ||
git commit Cargo.toml Cargo.lock -m "Release cargo-doc2readme $version" | ||
git push | ||
git tag -s -a -m "Version $version" "$version" | ||
git push --tags | ||
cargo publish --locked |