From 968de699b7bae90c2459f1712599573deeb64a56 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Tue, 27 Nov 2018 20:31:29 +1100 Subject: [PATCH] tools: check for git tag before promoting release PR-URL: https://github.com/nodejs/node/pull/24670 Reviewed-By: Daniel Bevenius Reviewed-By: James M Snell --- tools/release.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/release.sh b/tools/release.sh index fcb5ef124261a1..c828162f0ca54c 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -81,6 +81,14 @@ fi echo "Using GPG key: $gpgkey" echo " Fingerprint: $gpgfing" +function checktag { + local version=$1 + + if ! git tag -v $version 2>&1 | grep "${gpgkey}" | grep key > /dev/null; then + echo "Could not find signed tag for \"${version}\" or GPG key is not yours" + exit 1 + fi +} ################################################################################ ## Create and sign checksums file for a given version @@ -90,11 +98,6 @@ function sign { local version=$1 - if ! git tag -v $version 2>&1 | grep "${gpgkey}" | grep key > /dev/null; then - echo "Could not find signed tag for \"${version}\" or GPG key is not yours" - exit 1 - fi - ghtaggedversion=$(curl -sL https://raw.githubusercontent.com/nodejs/node/${version}/src/node_version.h \ | awk '/define NODE_(MAJOR|MINOR|PATCH)_VERSION/{ v = v "." $3 } END{ v = "v" substr(v, 2); print v }') if [ "${version}" != "${ghtaggedversion}" ]; then @@ -150,7 +153,8 @@ function sign { if [ -n "${signversion}" ]; then - sign ${signversion} + checktag $signversion + sign $signversion exit 0 fi @@ -192,6 +196,8 @@ for version in $versions; do continue fi + checktag $version + echo -e "\n# Promoting ${version}..." ssh ${customsshkey} ${webuser}@${webhost} $promotecmd nodejs $version