github.com/jameswoolfenden/terraform@v0.11.12-beta1/scripts/dist.sh (about) 1 #!/usr/bin/env bash 2 set -e 3 4 # Get the version from the command line 5 VERSION=$1 6 if [ -z $VERSION ]; then 7 echo "Please specify a version." 8 exit 1 9 fi 10 11 # Make sure we have a bintray API key 12 if [[ -z $AWS_ACCESS_KEY_ID || -z $AWS_SECRET_ACCESS_KEY ]]; then 13 echo "Please set AWS access keys as env vars before running this script." 14 exit 1 15 fi 16 17 # Get the parent directory of where this script is. 18 SOURCE="${BASH_SOURCE[0]}" 19 while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done 20 DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" 21 22 # Change into that dir because we expect that 23 cd $DIR 24 25 # Zip all the files 26 rm -rf ./pkg/dist 27 mkdir -p ./pkg/dist 28 for FILENAME in $(find ./pkg -mindepth 1 -maxdepth 1 -type f); do 29 FILENAME=$(basename $FILENAME) 30 cp ./pkg/${FILENAME} ./pkg/dist/terraform_${VERSION}_${FILENAME} 31 done 32 33 # Make the checksums 34 echo "==> Signing..." 35 pushd ./pkg/dist 36 rm -f ./terraform_${VERSION}_SHA256SUMS* 37 shasum -a256 * > ./terraform_${VERSION}_SHA256SUMS 38 gpg --default-key 348FFC4C --detach-sig ./terraform_${VERSION}_SHA256SUMS 39 popd 40 41 # Upload 42 hc-releases upload ./pkg/dist 43 44 exit 0