Add publish script

This commit is contained in:
Ivan Nikulin 2020-11-12 13:08:13 +00:00
parent 5afd10b577
commit 5a308ba6ab
1 changed files with 33 additions and 0 deletions

33
scripts/publish.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/sh
set -euo pipefail
SCRIPT_NAME=$(basename "$0")
REQUIRE_BRANCH='master'
CURRENT_BRANCH="$(git symbolic-ref --short HEAD)"
if [[ "$CURRENT_BRANCH" != "$REQUIRE_BRANCH" ]]; then
echo "Please \`git checkout $REQUIRE_BRANCH\` to run $SCRIPT_NAME (cannot run from current branch $CURRENT_BRANCH)."
exit 1
fi
if [[ "$(git diff --stat)" != '' ]]; then
echo 'Please commit or discard your changes before creating a new release.'
exit 1
fi
echo "=== Publishing boring-sys... ==="
(cd boring-sys && cargo publish)
sleep 20
echo "=== Publishing boring... ==="
(cd boring && cargo publish)
sleep 20
echo "=== Publishing tokio-boring... ==="
(cd tokio-boring && cargo publish)
sleep 20
echo "=== Publishing hyper-boring... ==="
(cd hyper-boring && cargo publish)
sleep 20