Skip to content

Commit 54756a7

Browse files
authored
Fix builds.hex.pm upload (#12580)
1 parent 61839b4 commit 54756a7

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

.github/workflows/builds.hex.pm.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,24 @@ jobs:
4242
build_docs: ${{ matrix.build_docs }}
4343
- name: Utils.sh
4444
run: |
45-
cat << EOF > utils.sh
45+
cat << 'EOF' > utils.sh
4646
function purge_key() {
4747
curl \
4848
-X POST \
4949
-H "Fastly-Key: ${FASTLY_KEY}" \
5050
-H "Accept: application/json" \
5151
-H "Content-Length: 0" \
52-
"https://api.fastly.com/service/${FASTLY_SERVICE_ID}/purge/$1"
52+
"https://api.fastly.com/service/$1/purge/$2"
5353
}
5454
function purge() {
55-
purge_key $1
55+
purge_key ${FASTLY_REPO_SERVICE_ID} $1
56+
purge_key ${FASTLY_BUILDS_SERVICE_ID} $1
5657
sleep 2
57-
purge_key $1
58+
purge_key ${FASTLY_REPO_SERVICE_ID} $1
59+
purge_key ${FASTLY_BUILDS_SERVICE_ID} $1
5860
sleep 2
59-
purge_key $1
61+
purge_key ${FASTLY_REPO_SERVICE_ID} $1
62+
purge_key ${FASTLY_BUILDS_SERVICE_ID} $1
6063
}
6164
EOF
6265
chmod +x utils.sh
@@ -67,7 +70,8 @@ jobs:
6770
AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }}
6871
AWS_REGION: ${{ secrets.HEX_AWS_REGION }}
6972
AWS_S3_BUCKET: ${{ secrets.HEX_AWS_S3_BUCKET }}
70-
FASTLY_SERVICE_ID: ${{ secrets.HEX_FASTLY_SERVICE_ID }}
73+
FASTLY_REPO_SERVICE_ID: ${{ secrets.HEX_FASTLY_REPO_SERVICE_ID }}
74+
FASTLY_BUILDS_SERVICE_ID: ${{ secrets.HEX_FASTLY_BUILDS_SERVICE_ID }}
7175
FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }}
7276
run: |
7377
source utils.sh
@@ -90,18 +94,25 @@ jobs:
9094
AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }}
9195
AWS_REGION: ${{ secrets.HEX_AWS_REGION }}
9296
AWS_S3_BUCKET: ${{ secrets.HEX_AWS_S3_BUCKET }}
97+
FASTLY_REPO_SERVICE_ID: ${{ secrets.HEX_FASTLY_REPO_SERVICE_ID }}
98+
FASTLY_BUILDS_SERVICE_ID: ${{ secrets.HEX_FASTLY_BUILDS_SERVICE_ID }}
99+
FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }}
93100
run: |
94-
aws s3 cp elixir-otp-${{ matrix.otp }}.zip "s3://${{ env.AWS_S3_BUCKET }}/builds/elixir/${{github.ref_name}}-otp-${{matrix.otp}}.zip" --cache-control "public,max-age=3600" --metadata '{"surrogate-key":"builds","surrogate-control":"public,max-age=604800"}'
101+
source utils.sh
102+
aws s3 cp elixir-otp-${{ matrix.otp }}.zip "s3://${{ env.AWS_S3_BUCKET }}/builds/elixir/${{github.ref_name}}-otp-${{matrix.otp}}.zip" --cache-control "public,max-age=3600" --metadata "{\"surrogate-key\":\"builds builds/elixir builds/elixir/${{github.ref_name}}-otp-${{matrix.otp}}\",\"surrogate-control\":\"public,max-age=604800\"}"
103+
purge builds/elixir/${{github.ref_name}}-otp-${{matrix.otp}}
95104
if [ "${{matrix.upload_generic_version}}" == "upload_generic_version" ]; then
96-
aws s3 cp elixir-otp-${{ matrix.otp }}.zip "s3://${{ env.AWS_S3_BUCKET }}/builds/elixir/${{github.ref_name}}.zip" --cache-control "public,max-age=3600" --metadata '{"surrogate-key":"builds","surrogate-control":"public,max-age=604800"}'
105+
aws s3 cp elixir-otp-${{ matrix.otp }}.zip "s3://${{ env.AWS_S3_BUCKET }}/builds/elixir/${{github.ref_name}}.zip" --cache-control "public,max-age=3600" --metadata "{\"surrogate-key\":\"builds builds/elixir builds/elixir/${{github.ref_name}}\",\"surrogate-control\":\"public,max-age=604800\"}"
106+
purge builds/elixir/${{github.ref_name}}
97107
fi
98108
- name: Update builds txt
99109
env:
100110
AWS_ACCESS_KEY_ID: ${{ secrets.HEX_AWS_ACCESS_KEY_ID }}
101111
AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }}
102112
AWS_REGION: ${{ secrets.HEX_AWS_REGION }}
103113
AWS_S3_BUCKET: ${{ secrets.HEX_AWS_S3_BUCKET }}
104-
FASTLY_SERVICE_ID: ${{ secrets.HEX_FASTLY_SERVICE_ID }}
114+
FASTLY_REPO_SERVICE_ID: ${{ secrets.HEX_FASTLY_REPO_SERVICE_ID }}
115+
FASTLY_BUILDS_SERVICE_ID: ${{ secrets.HEX_FASTLY_BUILDS_SERVICE_ID }}
105116
FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }}
106117
run: |
107118
source utils.sh
@@ -117,5 +128,5 @@ jobs:
117128
echo -e "${ref_name} ${{ github.sha }} ${date} ${build_sha256} \n$(cat builds.txt)" > builds.txt
118129
fi
119130
sort -u -k1,1 -o builds.txt builds.txt
120-
aws s3 cp builds.txt s3://${{ env.AWS_S3_BUCKET }}/builds/elixir/builds.txt --cache-control "public,max-age=3600" --metadata '{"surrogate-key":"builds","surrogate-control":"public,max-age=604800"}'
121-
purge builds
131+
aws s3 cp builds.txt s3://${{ env.AWS_S3_BUCKET }}/builds/elixir/builds.txt --cache-control "public,max-age=3600" --metadata '{"surrogate-key":"builds builds/elixir builds/elixir/txt","surrogate-control":"public,max-age=604800"}'
132+
purge builds/elixir/txt

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ Docs.zip: docs
235235

236236
Precompiled.zip: build_man compile
237237
rm -f Precompiled.zip
238-
zip -9 -r Precompiled.zip bin CHANGELOG.md lib/*/ebin lib/*/lib LICENSE man NOTICE README.md VERSION
238+
zip -9 -r Precompiled.zip bin CHANGELOG.md lib/*/ebin lib/*/lib LICENSE Makefile man NOTICE README.md VERSION
239239
@ echo "Precompiled file created $(CURDIR)/Precompiled.zip"
240240

241241
#==> Test tasks

0 commit comments

Comments
 (0)