github.com/diptanu/nomad@v0.5.7-0.20170516172507-d72e86cbe3d9/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. (format: 0.4.0-rc1)" 8 exit 1 9 fi 10 11 # Get the parent directory of where this script is. 12 SOURCE="${BASH_SOURCE[0]}" 13 while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done 14 DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" 15 16 # Change into that dir because we expect that 17 cd $DIR 18 19 # Generate the tag. 20 if [ -z $NOTAG ]; then 21 echo "==> Tagging..." 22 git commit --allow-empty -a --gpg-sign=348FFC4C -m "Release v$VERSION" 23 git tag -a -m "Version $VERSION" -s -u 348FFC4C "v${VERSION}" master 24 fi 25 26 # Zip all the files 27 rm -rf ./pkg/dist 28 mkdir -p ./pkg/dist 29 for FILENAME in $(find ./pkg -mindepth 1 -maxdepth 1 -type f); do 30 FILENAME=$(basename $FILENAME) 31 cp ./pkg/${FILENAME} ./pkg/dist/nomad_${VERSION}_${FILENAME} 32 done 33 34 # Make the checksums 35 pushd ./pkg/dist 36 shasum -a256 * > ./nomad_${VERSION}_SHA256SUMS 37 if [ -z $NOSIGN ]; then 38 echo "==> Signing..." 39 gpg --default-key 348FFC4C --detach-sig ./nomad_${VERSION}_SHA256SUMS 40 fi 41 popd 42 43 # Upload 44 if [ -z $HC_RELEASE ]; then 45 hc-releases upload $DIR/pkg/dist && hc-releases publish 46 fi