Skip to content

Commit

Permalink
build,tools: simplify upload of shasum signatures
Browse files Browse the repository at this point in the history
Use the same prompt for uploads to the web host and Cloudflare R2.

PR-URL: #53892
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
  • Loading branch information
targos authored and marco-ippolito committed Aug 19, 2024
1 parent 6cd212d commit cb68b02
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ sign() {
echo ""

while true; do
printf "Upload files to %s? [y/n] " "$webhost"
printf "Upload files to %s and Cloudflare R2? [y/n] " "$webhost"
yorn=""
read -r yorn

Expand All @@ -147,37 +147,26 @@ sign() {
fi

if [ "X${yorn}" = "Xy" ]; then
# Copy SHASUMS256.txt and its signatures to the web host:
# shellcheck disable=SC2086
scp ${customsshkey} "${tmpdir}/${shafile}" "${tmpdir}/${shafile}.asc" "${tmpdir}/${shafile}.sig" "${webuser}@${webhost}:${shadir}/"
# shellcheck disable=SC2086,SC2029
ssh ${customsshkey} "${webuser}@${webhost}" chmod 644 "${shadir}/${shafile}.asc" "${shadir}/${shafile}.sig"
break
fi
done

while true; do
printf "Upload files from %s to R2 staging bucket? [y/n]" "$webhost"
yorn=""
read -r yorn

if [ "X${yorn}" = "Xn" ]; then
break
fi

if [ "X${yorn}" = "Xy" ]; then
# Note: the binaries and SHASUMS256.txt should already be in this bucket since the DO will upload them
# Copy the signatures to Cloudflare R2:
# Note: the binaries and SHASUMS256.txt should already be in the bucket
# since the promotion script should take care of uploading them.

# Remove /home/dist/ part
r2dir=$(echo "$shadir" | cut -c 11-)

# Copy SHASUM256.txt.asc
# Copy SHASUMS256.txt.asc
# shellcheck disable=SC2086,SC2029
ssh ${customsshkey} "$webuser@$webhost" aws s3 cp "${shadir}/${shafile}.asc" "s3://${cloudflare_bucket}/${r2dir}/${shafile}.asc" --endpoint="${cloudflare_endpoint}" --profile=${cloudflare_profile}
ssh ${customsshkey} "${webuser}@${webhost}" aws s3 cp "${shadir}/${shafile}.asc" "s3://${cloudflare_bucket}/${r2dir}/${shafile}.asc" --endpoint="${cloudflare_endpoint}" --profile=${cloudflare_profile}

# Copy SHASUM256.txt.sig
# Copy SHASUMS256.txt.sig
# shellcheck disable=SC2086,SC2029
ssh ${customsshkey} "$webuser@$webhost" aws s3 cp "${shadir}/${shafile}.sig" "s3://${cloudflare_bucket}/${r2dir}/${shafile}.sig" --endpoint="${cloudflare_endpoint}" --profile=${cloudflare_profile}

ssh ${customsshkey} "${webuser}@${webhost}" aws s3 cp "${shadir}/${shafile}.sig" "s3://${cloudflare_bucket}/${r2dir}/${shafile}.sig" --endpoint="${cloudflare_endpoint}" --profile=${cloudflare_profile}
break
fi
done
Expand Down

0 comments on commit cb68b02

Please sign in to comment.