github.com/adamar/terraform@v0.2.2-0.20141016210445-2e703afdad0e/scripts/dist.sh (about) 1 #!/bin/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 $BINTRAY_API_KEY ]; then 13 echo "Please set your bintray API key in the BINTRAY_API_KEY env var." 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 pushd ./pkg/dist 35 shasum -a256 * > ./terraform_${VERSION}_SHA256SUMS 36 popd 37 38 # Upload 39 for ARCHIVE in ./pkg/dist/*; do 40 ARCHIVE_NAME=$(basename ${ARCHIVE}) 41 42 echo Uploading: $ARCHIVE_NAME 43 curl \ 44 -T ${ARCHIVE} \ 45 -umitchellh:${BINTRAY_API_KEY} \ 46 "https://api.bintray.com/content/mitchellh/terraform/terraform/${VERSION}/${ARCHIVE_NAME}" 47 done 48 49 exit 0