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 )"
|
2017-07-29 04:34:59 +00:00
|
|
|
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..."
|
|
|
|
cargo clean
|
2017-07-29 04:34:59 +00:00
|
|
|
bash "${SCRIPT_DIR}/test.sh"
|
2018-05-31 18:28:54 +00:00
|
|
|
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.
|
2017-07-29 04:34:59 +00:00
|
|
|
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
|
2017-07-29 04:34:59 +00:00
|
|
|
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.
|
2017-07-29 04:34:59 +00:00
|
|
|
mv "${LIB_DIR}/Cargo.toml.bak" "${LIB_DIR}/Cargo.toml"
|