github.com/djenriquez/nomad-1@v0.8.1/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  
    30  #find ./pkg -mindepth 1 -maxdepth 1 -type f -exec cp ./pkg/{} ./pkg/dist/nomad_"${VERSION}"_{} \;
    31  #for FILENAME in $(find ./pkg -mindepth 1 -maxdepth 1 -type f); do
    32  find ./pkg -mindepth 1 -maxdepth 1 -type f -print0 | while read -d '' -r FILENAME; do
    33    FILENAME=$(basename "$FILENAME")
    34    cp "./pkg/${FILENAME}" "./pkg/dist/nomad_${VERSION}_${FILENAME}"
    35  done
    36  
    37  # Make the checksums
    38  pushd ./pkg/dist
    39  shasum -a256 ./* > "./nomad_${VERSION}_SHA256SUMS"
    40  if [ -z "${NOSIGN}" ]; then
    41    echo "==> Signing..."
    42    gpg --default-key 348FFC4C --detach-sig "./nomad_${VERSION}_SHA256SUMS"
    43  fi
    44  popd
    45  
    46  # Upload
    47  if [ -z "${HC_RELEASE}" ]; then
    48    hc-releases upload "${DIR}/pkg/dist" && hc-releases publish
    49  fi