github.com/alouche/packer@v0.3.7/scripts/upload.sh (about)

     1  #!/bin/bash
     2  set -e
     3  
     4  # Get the parent directory of where this script is.
     5  SOURCE="${BASH_SOURCE[0]}"
     6  while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
     7  DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
     8  
     9  # Change into that dir because we expect that
    10  cd $DIR
    11  
    12  # Get the version from the command line
    13  VERSION=$1
    14  if [ -z $VERSION ]; then
    15      echo "Please specify a version."
    16      exit 1
    17  fi
    18  
    19  # Make sure we have a bintray API key
    20  if [ -z $BINTRAY_API_KEY ]; then
    21      echo "Please set your bintray API key in the BINTRAY_API_KEY env var."
    22      exit 1
    23  fi
    24  
    25  for ARCHIVE in ./pkg/${VERSION}/dist/*; do
    26      ARCHIVE_NAME=$(basename ${ARCHIVE})
    27  
    28      echo Uploading: $ARCHIVE_NAME
    29      curl \
    30          -T ${ARCHIVE} \
    31          -umitchellh:${BINTRAY_API_KEY} \
    32          "https://api.bintray.com/content/mitchellh/packer/packer/${VERSION}/${ARCHIVE_NAME}"
    33  done