cargo : assert-json-diff @ 2.0.2
bin/release
55 lines · plain
#!/bin/bashset -econfirm() { while true; do read -p "$1? Please double check. y/n? " yn case $yn in [Yy]* ) break;; [Nn]* ) exit 1;; * ) echo "Please answer yes or no.";; esac done}cargo fmt --all -- --checkecho "✔ code formatting looks good!"cargo checkecho "✔ types look good"cargo readme > README.mdecho "✔ README.md compiled"cargo test > /dev/nullecho "✔ tests are passing"confirm "Updated Cargo.toml"confirm "Updated CHANGELOG.md"version="$1"version_without_v="`sed \"s/v//g\" <(echo $version)`"if (echo $version | egrep "v\d+\.\d+\.\d+" > /dev/null)then confirm "Ready to release $version (as $version_without_v)?"else echo "Invalid version number: $1" exit 1fiversion_in_toml=$(cat Cargo.toml | egrep "^version = \"$version_without_v\"")if [[ "$version_in_toml" == "version = \"$version_without_v\"" ]]then trueelse echo "Cargo.toml isn't set to version $version_without_v"fiGIT_COMMITTER_DATE=$(git log -n1 --pretty=%aD) git tag -a -m "Release $version" $versiongit push --tagscargo publish --dry-runcargo publish || true