1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#!/bin/bash
# This script is used to do rustup releases. It requires an AWS access token
# allowed to update our S3 buckets and to invalidate CloudFront distributions.
#
# Usage:
#
# 1. Deploy the release on the dev environment:
# ./deploy.bash dev VERSION_NUMBER
#
# 2. Test everything works correctly:
# RUSTUP_UPDATE_ROOT=https://dev-static.rust-lang.org/rustup rustup self update
#
# 3. Deploy the release to the prod environment:
# ./deploy.bash prod VERSION_NUMBER
set -euo pipefail
IFS=$'\n\t'
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
LOCAL_RUSTUP_DIR="local-rustup"
usage() {
echo "usage: $0 {dev,prod} <version>"
exit 1
}
run() {
python3 "${CI_DIR}/sync-dist.py" "$@" --live-run
}
if [[ $# -ne 2 ]]; then
usage
fi
mode="$1"
version="$2"
case "${mode}" in
dev)
# Ask for confirmation before clearing the local directory
if [[ -e "${LOCAL_RUSTUP_DIR}" ]]; then
read -rp "The directory ${LOCAL_RUSTUP_DIR} will be removed. Continue (y/n)?" choice
case "${choice}" in
y|Y)
rm -rf "${LOCAL_RUSTUP_DIR}"
;;
*)
echo "Exiting..."
exit 0
esac
fi
run dev-to-local
run local-to-dev-archives "${version}"
run update-dev-release "${version}"
;;
prod)
run local-to-prod-archives "${version}"
run local-to-prod
run update-prod-release "${version}"
;;
*)
usage
;;
esac
|