Sync dist script from pki-csrs

This commit is contained in:
Jeff Mitchell 2015-12-01 13:12:58 -05:00
parent 564969acfd
commit 83fc154c98

View file

@ -8,9 +8,9 @@ if [ -z $VERSION ]; then
exit 1 exit 1
fi fi
# Make sure we have a bintray API key # Make sure we have AWS API keys
if [ -z $BINTRAY_API_KEY ] && [ ! -z $BINTRAY ]; then if ([ -z $AWS_ACCESS_KEY_ID ] || [ -z $AWS_SECRET_ACCESS_KEY ]) && [ ! -z $HC_RELEASE ]; then
echo "Please set your bintray API key in the BINTRAY_API_KEY env var." echo "Please set your AWS access key information in the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env vars."
exit 1 exit 1
fi fi
@ -22,17 +22,21 @@ DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
# Change into that dir because we expect that # Change into that dir because we expect that
cd $DIR cd $DIR
if [ -z $RELBRANCH ]; then
RELBRANCH=master
fi
# Tag, unless told not to # Tag, unless told not to
if [ -z $NOTAG ]; then if [ -z $NOTAG ]; then
echo "==> Tagging..." echo "==> Tagging..."
git commit --allow-empty -a --gpg-sign=348FFC4C -m "Cut version $VERSION" git commit --allow-empty -a --gpg-sign=348FFC4C -m "Cut version $VERSION"
git tag -a -m "Version $VERSION" -s -u 348FFC4C "v${VERSION}" master git tag -a -m "Version $VERSION" -s -u 348FFC4C "v${VERSION}" $RELBRANCH
fi fi
# Build the packages # Build the packages
if [ -z $NOBUILD ]; then if [ -z $NOBUILD ]; then
# Yes, jefferai/gox should be parameterized; it's just a local build of the Dockerfile in the cross dir # This should be a local build of the Dockerfile in the cross dir
docker run --rm -v "$(pwd)":/gopath/src/github.com/hashicorp/vault -w /gopath/src/github.com/hashicorp/vault jefferai/gox:1.5.1 docker run --rm -v "$(pwd)":/gopath/src/github.com/hashicorp/vault -w /gopath/src/github.com/hashicorp/vault ${DOCKER_CROSS_IMAGE}
fi fi
# Zip all the files # Zip all the files
@ -53,16 +57,8 @@ if [ -z $NOSIGN ]; then
fi fi
# Upload # Upload
if [ ! -z $BINTRAY ]; then if [ ! -z $HC_RELEASE ]; then
for ARCHIVE in ./pkg/dist/*; do hc-releases -upload $DIR/pkg/dist --publish --purge
ARCHIVE_NAME=$(basename ${ARCHIVE})
echo Uploading: $ARCHIVE_NAME
curl \
-T ${ARCHIVE} \
-umitchellh:${BINTRAY_API_KEY} \
"https://api.bintray.com/content/mitchellh/vault/vault/${VERSION}/${ARCHIVE_NAME}"
done
fi fi
exit 0 exit 0