build, tools: copy release assets to staging R2 bucket once built · nodejs/node@18c530f · GitHub
Skip to content

Commit 18c530f

Browse files
flakey5targos
andcommitted
build, tools: copy release assets to staging R2 bucket once built
Co-authored-by: Michaël Zasso <targos@protonmail.com> PR-URL: #51394 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent f770a99 commit 18c530f

3 files changed

Lines changed: 60 additions & 1 deletion

File tree

Makefile

Lines changed: 11 additions & 0 deletions

tools/release.sh

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ promotecmd=dist-promote
1717
signcmd=dist-sign
1818
customsshkey="" # let ssh and scp use default key
1919
signversion=""
20+
cloudflare_bucket="dist-prod"
21+
cloudflare_endpoint=https://07be8d2fbc940503ca1be344714cb0d1.r2.cloudflarestorage.com # Node.js Cloudflare account
22+
cloudflare_profile="worker"
2023

2124
while getopts ":i:s:" option; do
2225
case "${option}" in
@@ -102,6 +105,7 @@ sign() {
102105
exit 1
103106
fi
104107

108+
# /home/dist/${site}/release
105109
# shellcheck disable=SC2086,SC2029
106110
shapath=$(ssh ${customsshkey} "${webuser}@${webhost}" $signcmd nodejs $1)
107111

@@ -134,7 +138,7 @@ sign() {
134138
echo ""
135139

136140
while true; do
137-
printf "Upload files? [y/n] "
141+
printf "Upload files to %s? [y/n] " "$webhost"
138142
yorn=""
139143
read -r yorn
140144

@@ -151,6 +155,33 @@ sign() {
151155
fi
152156
done
153157

158+
while true; do
159+
printf "Upload files from %s to R2 staging bucket? [y/n]" "$webhost"
160+
yorn=""
161+
read -r yorn
162+
163+
if [ "X${yorn}" = "Xn" ]; then
164+
break
165+
fi
166+
167+
if [ "X${yorn}" = "Xy" ]; then
168+
# Note: the binaries and SHASUMS256.txt should already be in this bucket since the DO will upload them
169+
170+
# Remove /home/dist/ part
171+
r2dir=$(echo "$shadir" | cut -c 11-)
172+
173+
# Copy SHASUM256.txt.asc
174+
# shellcheck disable=SC2086,SC2029
175+
ssh ${customsshkey} "$webuser@$webhost" aws s3 cp "${shadir}/${shafile}.asc" "s3://${cloudflare_bucket}/${r2dir}/${shafile}.asc" --endpoint="${cloudflare_endpoint}" --profile=${cloudflare_profile}
176+
177+
# Copy SHASUM256.txt.sig
178+
# shellcheck disable=SC2086,SC2029
179+
ssh ${customsshkey} "$webuser@$webhost" aws s3 cp "${shadir}/${shafile}.sig" "s3://${cloudflare_bucket}/${r2dir}/${shafile}.sig" --endpoint="${cloudflare_endpoint}" --profile=${cloudflare_profile}
180+
181+
break
182+
fi
183+
done
184+
154185
rm -rf $tmpdir
155186
}
156187

vcbuild.bat

Lines changed: 17 additions & 0 deletions

0 commit comments

Comments
 (0)