Rocket/scripts/publish.sh

40 lines
1.1 KiB
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 21:05:32 +00:00
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 [debug]..."
2016-12-24 21:05:32 +00:00
cargo clean
bash "${SCRIPT_DIR}/test.sh"
echo ":::: Running test suite [release]..."
cargo clean
bash "${SCRIPT_DIR}/test.sh" --release
2016-12-24 21:05:32 +00:00
# Temporarily remove the dependency on codegen from core so crates.io verifies.
sed -i.bak 's/rocket_codegen.*//' "${LIB_DIR}/Cargo.toml"
2016-12-24 21:05:32 +00:00
# Publish all the things.
for dir in "${LIB_DIR}" "${CODEGEN_DIR}" "${CONTRIB_DIR}"; do
pushd "${dir}"
2016-12-24 21:05:32 +00:00
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"