Skip to content

Commit

Permalink
Update dist script
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferai committed Sep 27, 2015
1 parent 9f530d8 commit 102190f
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions scripts/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ -z $VERSION ]; then
fi

# Make sure we have a bintray API key
if [ -z $BINTRAY_API_KEY ]; then
if [ -z $BINTRAY_API_KEY ] && [ ! -z $NOBINTRAY ]; then
echo "Please set your bintray API key in the BINTRAY_API_KEY env var."
exit 1
fi
Expand All @@ -22,6 +22,19 @@ DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
# Change into that dir because we expect that
cd $DIR

# Tag, unless told not to
if [ -z $NOTAG ]; then
echo "==> Tagging..."
git commit --allow-empty -a --gpg-sign=348FFC4C -m "Cut version $VERSION"
git tag -a -m "Version $VERSION" -s -u 348FFC4C "v${VERSION}" master
fi

# Build the packages
if [ -z $NOBUILD ]; then
# Yes, jefferai/gox should be parameterized; it's just 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
fi

# Zip all the files
rm -rf ./pkg/dist
mkdir -p ./pkg/dist
Expand All @@ -30,22 +43,26 @@ for FILENAME in $(find ./pkg -mindepth 1 -maxdepth 1 -type f); do
cp ./pkg/${FILENAME} ./pkg/dist/vault_${VERSION}_${FILENAME}
done

# Make the checksums
pushd ./pkg/dist
rm -f ./vault_${VERSION}_SHA256SUMS*
shasum -a256 * > ./vault_${VERSION}_SHA256SUMS
gpg --default-key 348FFC4C --detach-sig ./vault_${VERSION}_SHA256SUMS
popd
if [ -z $NOSIGN ]; then
echo "==> Signing..."
pushd ./pkg/dist
rm -f ./vault_${VERSION}_SHA256SUMS*
shasum -a256 * > ./vault_${VERSION}_SHA256SUMS
gpg --default-key 348FFC4C --detach-sig ./vault_${VERSION}_SHA256SUMS
popd
fi

# Upload
for ARCHIVE in ./pkg/dist/*; do
if [ ! -z $NOBINTRAY ]; then
for ARCHIVE in ./pkg/dist/*; do
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
done
fi

exit 0

0 comments on commit 102190f

Please sign in to comment.