diff --git a/.gitignore b/.gitignore index 313b28ea..16114053 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ _TODO # The upload script, for now. scripts/upload-docs.sh + +# Backup files. +*.bak diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100755 index 00000000..a6715a74 --- /dev/null +++ b/scripts/publish.sh @@ -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