From 5746bc54e85144eba65eb8e23e3a903389743ac0 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 16 Dec 2020 15:54:59 +0100 Subject: [PATCH 1/2] tools: fix release script --- tools/release.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/tools/release.sh b/tools/release.sh index dcd9755d42f7d2..941321d2768b34 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -57,17 +57,17 @@ elif [ "$keycount" -ne 1 ]; then keynum= while [ -z "${keynum##*[!0-9]*}" ] || [ "$keynum" -le 0 ] || [ "$keynum" -gt "$keycount" ]; do - echo "$gpgkey" | awk '{ for(i = 1; i <= NF; i++) { print i ") " $i; } }' + echo "$gpgkey" | awk '{ print NR ") " $0; }' printf 'Select a key: ' read -r keynum done echo "" - gpgkey=$(echo "$gpgkey" | awk "{ print \$${keynum}}") + gpgkey=$(echo "$gpgkey" | sed -n "${keynum}p") fi gpgfing=$(gpg --keyid-format 0xLONG --fingerprint "$gpgkey" | grep 'Key fingerprint =' | awk -F' = ' '{print $2}' | tr -d ' ') -grep "$gpgfing" README.md || (\ +grep "$gpgfing" README.md > /dev/null || (\ echo 'Error: this GPG key fingerprint is not listed in ./README.md' && \ exit 1 \ ) @@ -93,15 +93,15 @@ sign() { # local version=$1 - ghtaggedversion=$(curl -sL https://raw.githubusercontent.com/nodejs/node/"$1"/src/node_version.h \ + ghtaggedversion=$(curl -sL "https://raw.githubusercontent.com/nodejs/node/$1/src/node_version.h" \ | awk '/define NODE_(MAJOR|MINOR|PATCH)_VERSION/{ v = v "." $3 } END{ v = "v" substr(v, 2); print v }') if [ "$1" != "${ghtaggedversion}" ]; then echo "Could not find tagged version on github.com/nodejs/node, did you push your tag?" exit 1 fi - # shellcheck disable=SC2029 - shapath=$(ssh "${customsshkey}" "${webuser}@${webhost}" $signcmd nodejs "$1") + # shellcheck disable=SC2086,SC2029 + shapath=$(ssh ${customsshkey} "${webuser}@${webhost}" $signcmd nodejs $1) echo "${shapath}" | grep -q '^/.*/SHASUMS256.txt$' || \ echo 'Error: No SHASUMS file returned by sign!' \ @@ -116,10 +116,11 @@ sign() { mkdir -p $tmpdir - scp "${customsshkey}" "${webuser}@${webhost}:${shapath}" "${tmpdir}/${shafile}" + # shellcheck disable=SC2086 + scp ${customsshkey} "${webuser}@${webhost}:${shapath}" "${tmpdir}/${shafile}" - gpg --default-key "$gpgkey" --clearsign --digest-algo SHA256 ${tmpdir}/"${shafile}" - gpg --default-key "$gpgkey" --detach-sign --digest-algo SHA256 ${tmpdir}/"${shafile}" + gpg --default-key "$gpgkey" --clearsign --digest-algo SHA256 "${tmpdir}/${shafile}" + gpg --default-key "$gpgkey" --detach-sign --digest-algo SHA256 "${tmpdir}/${shafile}" echo "Wrote to ${tmpdir}/" @@ -141,8 +142,8 @@ sign() { if [ "X${yorn}" = "Xy" ]; then scp "${customsshkey}" "${tmpdir}/${shafile}" "${tmpdir}/${shafile}.asc" "${tmpdir}/${shafile}.sig" "${webuser}@${webhost}:${shadir}/" - #shellcheck disable=SC2029 - ssh "${customsshkey}" "${webuser}@${webhost}" chmod 644 "${shadir}/${shafile}.asc" "${shadir}/${shafile}.sig" + # shellcheck disable=SC2086,SC2029 + ssh ${customsshkey} "${webuser}@${webhost}" chmod 644 "${shadir}/${shafile}.asc" "${shadir}/${shafile}.sig" break fi done @@ -164,7 +165,8 @@ fi printf "\n# Checking for releases ...\n" -promotable=$(ssh "${customsshkey}" "$webuser@$webhost" $promotablecmd nodejs) +# shellcheck disable=SC2086,SC2029 +promotable=$(ssh ${customsshkey} "$webuser@$webhost" $promotablecmd nodejs) if [ "X${promotable}" = "X" ]; then echo "No releases to promote!" @@ -201,8 +203,8 @@ for version in $versions; do echo "" echo "# Promoting ${version}..." - # shellcheck disable=SC2029 - ssh "${customsshkey}" "$webuser@$webhost" $promotecmd nodejs "$version" && \ + # shellcheck disable=SC2086,SC2029 + ssh ${customsshkey} "$webuser@$webhost" $promotecmd nodejs $version && \ sign "$version" break From caea529acd541d2666d331e05fc0ad8e3ec0d767 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 16 Dec 2020 10:44:30 -0500 Subject: [PATCH 2/2] fixup! tools: fix release script --- tools/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/release.sh b/tools/release.sh index 941321d2768b34..d327bad73c6f15 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -67,7 +67,7 @@ fi gpgfing=$(gpg --keyid-format 0xLONG --fingerprint "$gpgkey" | grep 'Key fingerprint =' | awk -F' = ' '{print $2}' | tr -d ' ') -grep "$gpgfing" README.md > /dev/null || (\ +grep -q "$gpgfing" README.md || (\ echo 'Error: this GPG key fingerprint is not listed in ./README.md' && \ exit 1 \ )