Rocket/scripts/publish.sh

36 lines
1007 B
Bash
Raw Normal View History

2016-12-24 21:05:32 +00:00
#! /usr/bin/env bash
set -e
#
# Publishes the current versions of core, contrib, and codegen to crates.io.
#
2016-12-29 04:33:56 +00:00
# Brings in: ROOT_DIR, EXAMPLES_DIR, LIB_DIR, CODEGEN_DIR, CONTRIB_DIR, DOC_DIR
2016-12-24 21:05:32 +00:00
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/config.sh
2016-12-24 23:33:43 +00:00
if ! [ -z "$(git status --porcelain)" ]; then
echo "There are uncommited changes! Aborting."
exit 1
fi
2016-12-24 21:05:32 +00:00
# Ensure everything passes before trying to publish.
echo ":::: Running test suite..."
cargo clean
${SCRIPT_DIR}/test.sh
# Temporarily remove the dependency on codegen from core so crates.io verifies.
sed -i.bak 's/rocket_codegen.*//' ${LIB_DIR}/Cargo.toml
# Publish all the things.
for dir in "${LIB_DIR}" "${CODEGEN_DIR}" "${CONTRIB_DIR}"; do
pushd ${dir}
echo ":::: Publishing '${dir}..."
# We already checked things ourselves. Don't spend time reverifying.
2016-12-24 23:33:43 +00:00
cargo publish --no-verify --allow-dirty
2016-12-24 21:05:32 +00:00
popd
done
# Restore the original core Cargo.toml.
mv ${LIB_DIR}/Cargo.toml.bak ${LIB_DIR}/Cargo.toml