github.com/cbusbey/terraform@v0.6.7-0.20151117151122-e7a054c9dd64/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 $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 hc-releases -upload=./pkg/dist 40 41 exit 0