Skip to content

Commit 4ac9cd6

Browse files
author
Josep Lluis Giralt D'Lacoste
committed
PR feedback, builds key needs to be purged
1 parent 3a18d82 commit 4ac9cd6

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

.github/workflows/repo.hex.pm.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ jobs:
3434
otp_version: ${{ matrix.otp_version }}
3535
otp: ${{ matrix.otp }}
3636
build_docs: ${{ matrix.build_docs }}
37+
- name: Utils.sh
38+
run: |
39+
cat << EOF > utils.sh
40+
function purge_key() {
41+
curl \
42+
-X POST \
43+
-H "Fastly-Key: ${FASTLY_KEY}" \
44+
-H "Accept: application/json" \
45+
-H "Content-Length: 0" \
46+
"https://api.fastly.com/service/${FASTLY_SERVICE_ID}/purge/$1"
47+
}
48+
EOF
49+
chmod +x utils.sh
3750
- name: Upload Docs to S3
3851
if: ${{ matrix.build_docs }}
3952
env:
@@ -44,15 +57,7 @@ jobs:
4457
FASTLY_SERVICE_ID: ${{ secrets.HEX_FASTLY_SERVICE_ID }}
4558
FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }}
4659
run: |
47-
function purge_key() {
48-
curl \
49-
-X POST \
50-
-H "Fastly-Key: ${FASTLY_KEY}" \
51-
-H "Accept: application/json" \
52-
-H "Content-Length: 0" \
53-
"https://api.fastly.com/service/${FASTLY_SERVICE_ID}/purge/$1"
54-
}
55-
60+
source utils.sh
5661
version=$(echo ${{ github.ref_name }} | sed -e 's/^v//g')
5762
for f in doc/*; do
5863
if [ -d "$f" ]; then
@@ -86,7 +91,10 @@ jobs:
8691
AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }}
8792
AWS_REGION: ${{ secrets.HEX_AWS_REGION }}
8893
AWS_S3_BUCKET: ${{ secrets.HEX_AWS_S3_BUCKET }}
94+
FASTLY_SERVICE_ID: ${{ secrets.HEX_FASTLY_SERVICE_ID }}
95+
FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }}
8996
run: |
97+
source utils.sh
9098
date=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
9199
build_sha256=$(sha256sum elixir.zip | cut -d ' ' -f 1)
92100
ref_name=${{ github.ref_name }}
@@ -96,3 +104,4 @@ jobs:
96104
echo -e "${ref_name}${{ matrix.otp }} ${{ github.sha }} ${date} ${build_sha256} \n$(cat builds.txt)" > builds.txt
97105
sort -u -k1,1 -o builds.txt builds.txt
98106
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"}'
107+
purge_key builds

0 commit comments

Comments
 (0)