2016-02-01 19:25:55 +00:00
|
|
|
#!/usr/bin/env bash
|
2013-12-19 19:22:08 +00:00
|
|
|
set -e
|
|
|
|
|
2016-02-13 00:50:37 +00:00
|
|
|
export GO15VENDOREXPERIMENT=1
|
|
|
|
|
2016-02-18 07:16:47 +00:00
|
|
|
# Get the version from the command line.
|
2014-04-16 23:53:26 +00:00
|
|
|
VERSION=$1
|
|
|
|
if [ -z $VERSION ]; then
|
|
|
|
echo "Please specify a version."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-12-19 19:22:08 +00:00
|
|
|
# Get the parent directory of where this script is.
|
|
|
|
SOURCE="${BASH_SOURCE[0]}"
|
|
|
|
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
|
|
|
|
DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
|
|
|
|
|
2016-02-18 07:16:47 +00:00
|
|
|
# Change into that dir because we expect that.
|
2013-12-19 19:22:08 +00:00
|
|
|
cd $DIR
|
|
|
|
|
2016-02-18 07:16:47 +00:00
|
|
|
# Generate the tag.
|
2015-10-22 18:16:01 +00:00
|
|
|
if [ -z $NOTAG ]; then
|
|
|
|
echo "==> Tagging..."
|
|
|
|
git commit --allow-empty -a --gpg-sign=348FFC4C -m "Release v$VERSION"
|
|
|
|
git tag -a -m "Version $VERSION" -s -u 348FFC4C "v${VERSION}" master
|
|
|
|
fi
|
2014-05-20 19:48:17 +00:00
|
|
|
|
2016-02-18 07:16:47 +00:00
|
|
|
# Do a hermetic build inside a Docker container.
|
|
|
|
if [ -z $NOBUILD ]; then
|
|
|
|
docker build -t hashicorp/consul-builder scripts/consul-builder/
|
2016-11-02 22:53:02 +00:00
|
|
|
docker run --rm -v "$(pwd)":/gopath/src/github.com/hashicorp/consul hashicorp/consul-builder ./scripts/dist_build.sh
|
2015-10-22 18:16:01 +00:00
|
|
|
fi
|
2014-05-01 18:01:54 +00:00
|
|
|
|
2016-02-18 07:16:47 +00:00
|
|
|
# Zip all the files.
|
2015-10-22 18:16:01 +00:00
|
|
|
rm -rf ./pkg/dist
|
|
|
|
mkdir -p ./pkg/dist
|
|
|
|
for FILENAME in $(find ./pkg -mindepth 1 -maxdepth 1 -type f); do
|
|
|
|
FILENAME=$(basename $FILENAME)
|
|
|
|
cp ./pkg/${FILENAME} ./pkg/dist/consul_${VERSION}_${FILENAME}
|
2013-12-19 19:22:08 +00:00
|
|
|
done
|
|
|
|
|
2016-02-18 07:16:47 +00:00
|
|
|
# Make the checksums.
|
2015-10-22 18:16:01 +00:00
|
|
|
pushd ./pkg/dist
|
|
|
|
shasum -a256 * > ./consul_${VERSION}_SHA256SUMS
|
|
|
|
if [ -z $NOSIGN ]; then
|
|
|
|
echo "==> Signing..."
|
|
|
|
gpg --default-key 348FFC4C --detach-sig ./consul_${VERSION}_SHA256SUMS
|
|
|
|
fi
|
2013-12-19 19:22:08 +00:00
|
|
|
popd
|
|
|
|
|
2015-10-26 21:30:29 +00:00
|
|
|
exit 0
|