github.com/ryanslade/nomad@v0.2.4-0.20160128061903-fc95782f2089/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  # 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  # Zip all the files
    20  rm -rf ./pkg/dist
    21  mkdir -p ./pkg/dist
    22  for FILENAME in $(find ./pkg -mindepth 1 -maxdepth 1 -type f); do
    23      FILENAME=$(basename $FILENAME)
    24      cp ./pkg/${FILENAME} ./pkg/dist/nomad_${VERSION}_${FILENAME}
    25  done
    26  
    27  # Make the checksums
    28  pushd ./pkg/dist
    29  shasum -a256 * > ./nomad_${VERSION}_SHA256SUMS
    30  if [ -z $NOSIGN ]; then
    31    echo "==> Signing..."
    32    gpg --default-key 348FFC4C --detach-sig ./nomad_${VERSION}_SHA256SUMS
    33  fi
    34  popd