From 4981d44cb57a928727b71d8632232395c91c2819 Mon Sep 17 00:00:00 2001 From: Tim Knight <97080547+gigatim@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:35:20 +0300 Subject: [PATCH] Add sha256 to OTP builds.txt (#188) --- priv/scripts/otp/otp.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/priv/scripts/otp/otp.sh b/priv/scripts/otp/otp.sh index c345e90..82f6467 100755 --- a/priv/scripts/otp/otp.sh +++ b/priv/scripts/otp/otp.sh @@ -39,12 +39,14 @@ docker cp ${container}:/home/build/out/${ref_name}.tar.gz ${ref_name}.tar.gz docker rm -f ${container} +build_sha256=$(sha256sum ${ref_name}.tar.gz | cut -d ' ' -f 1) + aws s3 cp ${ref_name}.tar.gz s3://s3.hex.pm/builds/otp/${arch}/${linux}/${ref_name}.tar.gz --cache-control "public,max-age=3600" --metadata "{\"surrogate-key\":\"builds builds/otp builds/otp/${arch} builds/otp/${arch}/${linux} builds/otp/${arch}/${linux}/${ref_name}\",\"surrogate-control\":\"public,max-age=604800\"}" aws s3 cp s3://s3.hex.pm/builds/otp/${arch}/${linux}/builds.txt builds.txt || true touch builds.txt sed -i "/^${ref_name} /d" builds.txt -echo -e "${ref_name} ${ref} $(date -u '+%Y-%m-%dT%H:%M:%SZ')\n$(cat builds.txt)" > builds.txt +echo -e "${ref_name} ${ref} $(date -u '+%Y-%m-%dT%H:%M:%SZ') ${build_sha256}\n$(cat builds.txt)" > builds.txt sort -u -k1,1 -o builds.txt builds.txt aws s3 cp builds.txt s3://s3.hex.pm/builds/otp/${arch}/${linux}/builds.txt --cache-control "public,max-age=3600" --metadata "{\"surrogate-key\":\"builds builds/otp builds/otp/${arch} builds/otp/${arch}/${linux} builds/otp/${arch}/${linux}/txt\",\"surrogate-control\":\"public,max-age=604800\"}"