Skip to content

Commit cdbfa09

Browse files
ericmjjosevalim
authored andcommitted
Fix hex upload of Elixir build without -otp- suffix (#14840)
OTP 25 is no longer supported so we didn't upload a generic build. Instead find the oldest version instead of hardcoding it.
1 parent baa2599 commit cdbfa09

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ jobs:
309309
AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }}
310310
AWS_REGION: ${{ vars.HEX_AWS_REGION }}
311311
AWS_S3_BUCKET: ${{ vars.HEX_AWS_S3_BUCKET }}
312-
OTP_GENERIC_VERSION: "25"
313312
steps:
314313
- name: "Check if variables are set up"
315314
if: "${{ ! vars.HEX_AWS_REGION }}"
@@ -330,6 +329,8 @@ jobs:
330329
run: |
331330
ref_name=${{ github.ref_name }}
332331
332+
oldest_otp=$(find . -type f -name 'elixir-otp-*.zip' | sed -r 's/^.*elixir-otp-([[:digit:]]+)\.zip$/\1/' | sort -n | head -n 1)
333+
333334
for zip in $(find . -type f -name 'elixir-otp-*.zip' | sed 's/^\.\///'); do
334335
dest=${zip/elixir/${ref_name}}
335336
surrogate_key=${dest/.zip$/}
@@ -339,7 +340,7 @@ jobs:
339340
--metadata "{\"surrogate-key\":\"builds builds/elixir builds/elixir/${surrogate_key}\",\"surrogate-control\":\"public,max-age=604800\"}"
340341
echo "builds/elixir/${surrogate_key}" >> purge_keys.txt
341342
342-
if [ "$zip" == "elixir-otp-${OTP_GENERIC_VERSION}.zip" ]; then
343+
if [ "$zip" == "elixir-otp-${oldest_otp}.zip" ]; then
343344
aws s3 cp "${zip}" "s3://${AWS_S3_BUCKET}/builds/elixir/${ref_name}.zip" \
344345
--cache-control "public,max-age=3600" \
345346
--metadata "{\"surrogate-key\":\"builds builds/elixir builds/elixir/${ref_name}\",\"surrogate-control\":\"public,max-age=604800\"}"
@@ -372,6 +373,8 @@ jobs:
372373
date="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
373374
ref_name=${{ github.ref_name }}
374375
376+
oldest_otp=$(find . -name 'elixir-otp-*.zip.sha256sum' | sed -r 's/^.*elixir-otp-([[:digit:]]+)\.zip\.sha256sum$/\1/' | sort -n | head -n 1)
377+
375378
aws s3 cp "s3://${AWS_S3_BUCKET}/builds/elixir/builds.txt" builds.txt || true
376379
touch builds.txt
377380
@@ -382,7 +385,7 @@ jobs:
382385
sed -i "/^${ref_name}-${otp_version} /d" builds.txt
383386
echo -e "${ref_name}-${otp_version} ${{ github.sha }} ${date} ${build_sha256} \n$(cat builds.txt)" > builds.txt
384387
385-
if [ "${otp_version}" == "otp-${OTP_GENERIC_VERSION}" ]; then
388+
if [ "${otp_version}" == "otp-${oldest_otp}" ]; then
386389
sed -i "/^${ref_name} /d" builds.txt
387390
echo -e "${ref_name} ${{ github.sha }} ${date} ${build_sha256} \n$(cat builds.txt)" > builds.txt
388391
fi

0 commit comments

Comments
 (0)