Add script to automate publishing.

This commit is contained in:
Sergio Benitez 2016-12-24 13:05:32 -08:00
parent 61a998f227
commit de6de99caf
2 changed files with 33 additions and 0 deletions

3
.gitignore vendored
View File

@ -22,3 +22,6 @@ _TODO
# The upload script, for now.
scripts/upload-docs.sh
# Backup files.
*.bak

30
scripts/publish.sh Executable file
View File

@ -0,0 +1,30 @@
#! /usr/bin/env bash
set -e
#
# Publishes the current versions of core, contrib, and codegen to crates.io.
#
# Brings in: EXAMPLES_DIR, LIB_DIR, CODEGEN_DIR, CONTRIB_DIR, DOC_DIR
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/config.sh
# 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.
cargo publish --no-verify
popd
done
# Restore the original core Cargo.toml.
mv ${LIB_DIR}/Cargo.toml.bak ${LIB_DIR}/Cargo.toml