github.com/tiagovtristao/plz@v13.4.0+incompatible/tools/misc/upload_release.sh (about) 1 #!/usr/bin/env bash 2 # Script to automatically upload new Please versions. 3 # Will not overwrite existing versions, only adds new ones. 4 # Should be run from the root of the repo, and only by a CI system. 5 6 set -euo pipefail 7 RED="\x1B[31m" 8 GREEN="\x1B[32m" 9 YELLOW="\x1B[33m" 10 RESET="\x1B[0m" 11 12 BUCKET="s3://get.please.build" 13 14 VERSION="$(cat VERSION)" 15 eval $(go env) 16 echo -e "${GREEN}Identifying outputs...${RESET}" 17 TARGETS="//package:please_tarball //package:please_tarball_xz //package:servers_tarball" 18 19 FILES="$(plz-out/bin/src/please query outputs $TARGETS ${TARGETS// /_signed }_signed)" 20 UPLOADED='' 21 for FILE in $FILES; do 22 BN="$(basename $FILE)" 23 DEST="${BUCKET}/${GOOS}_${GOARCH}/${VERSION}/${BN}" 24 echo -e "${GREEN}Checking ${DEST}...${RESET}" 25 if aws s3 ls $DEST > /dev/null ; then 26 echo -e "${YELLOW}${DEST} already exists, will not update${RESET}" 27 else 28 echo -e "${GREEN}Uploading ${FILE} to ${DEST}...${RESET}" 29 aws s3 cp $FILE $DEST 30 UPLOADED=true 31 fi 32 done 33 34 if [[ "$VERSION" =~ .*(alpha|beta|pre|rc).* ]]; then 35 echo -e "${YELLOW}Pre-release version found, will not update latest_version.${RESET}" 36 elif [ "$UPLOADED" = true ]; then 37 echo -e "${GREEN}Uploaded at least one file, updating latest_version...${RESET}" 38 aws s3 cp "VERSION" "${BUCKET}/latest_version" 39 else 40 echo -e "${YELLOW}Didn't upload anything, will not update latest_version${RESET}" 41 fi