open-consul/scripts/dist.sh

52 lines
1.3 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2013-12-19 19:22:08 +00:00
set -e
export GO15VENDOREXPERIMENT=1
# 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 )"
# Change into that dir because we expect that.
2013-12-19 19:22:08 +00:00
cd $DIR
# 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
# Do a hermetic build inside a Docker container.
if [ -z $NOBUILD ]; then
docker build -t hashicorp/consul-builder scripts/consul-builder/
docker run --rm -v "$(pwd)":/gopath/src/github.com/hashicorp/consul hashicorp/consul-builder
2015-10-22 18:16:01 +00:00
fi
2014-05-01 18:01:54 +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
# 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