Skip to content

Commit

Permalink
Merge pull request #5621 from hashicorp/r-release-preflight
Browse files Browse the repository at this point in the history
Update release/dist script with preflight
  • Loading branch information
Mahmood Ali authored Apr 30, 2019
2 parents cb7aa2b + 6051986 commit 2306928
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions scripts/dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,38 @@ if [ -z "${VERSION}" ]; then
exit 1
fi

gpg_signing_key=348FFC4C

verify_hc_releases() {
if ! command -v hc-releases 2>/dev/null >/dev/null
then
echo "hc-releases binary is not present" >&2
exit 1
fi
}

verify_gpg_key() {
if ! gpg --list-keys "${gpg_signing_key}" >/dev/null 2>/dev/null
then
echo "gpg key ${gpg_signing_key} is not present" >&2
exit 1
fi
}

verify_s3_access() {
if ! aws s3 ls s3://hc-releases/ >dev/null 2>/dev/null
then
echo "AWS credentials is not configured" >&2
exit 1
fi
}

if [ -z "${NO_PREFLIGHT}" ]; then
verify_hc_releases
verify_gpg_key
verify_s3_access
fi

# Get the parent directory of where this script is.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
Expand All @@ -19,8 +51,8 @@ cd "${DIR}"
# Generate the tag.
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
git commit --allow-empty -a --gpg-sign=${gpg_signing_key} -m "Release v$VERSION"
git tag -a -m "Version $VERSION" -s -u ${gpg_signing_key} "v${VERSION}" master
fi

# Zip all the files
Expand Down

0 comments on commit 2306928

Please sign in to comment.