|
34 | 34 | otp_version: ${{ matrix.otp_version }} |
35 | 35 | otp: ${{ matrix.otp }} |
36 | 36 | 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 |
37 | 50 | - name: Upload Docs to S3 |
38 | 51 | if: ${{ matrix.build_docs }} |
39 | 52 | env: |
|
44 | 57 | FASTLY_SERVICE_ID: ${{ secrets.HEX_FASTLY_SERVICE_ID }} |
45 | 58 | FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }} |
46 | 59 | 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 |
56 | 61 | version=$(echo ${{ github.ref_name }} | sed -e 's/^v//g') |
57 | 62 | for f in doc/*; do |
58 | 63 | if [ -d "$f" ]; then |
|
86 | 91 | AWS_SECRET_ACCESS_KEY: ${{ secrets.HEX_AWS_SECRET_ACCESS_KEY }} |
87 | 92 | AWS_REGION: ${{ secrets.HEX_AWS_REGION }} |
88 | 93 | AWS_S3_BUCKET: ${{ secrets.HEX_AWS_S3_BUCKET }} |
| 94 | + FASTLY_SERVICE_ID: ${{ secrets.HEX_FASTLY_SERVICE_ID }} |
| 95 | + FASTLY_KEY: ${{ secrets.HEX_FASTLY_KEY }} |
89 | 96 | run: | |
| 97 | + source utils.sh |
90 | 98 | date=$(date -u '+%Y-%m-%dT%H:%M:%SZ') |
91 | 99 | build_sha256=$(sha256sum elixir.zip | cut -d ' ' -f 1) |
92 | 100 | ref_name=${{ github.ref_name }} |
|
96 | 104 | echo -e "${ref_name}${{ matrix.otp }} ${{ github.sha }} ${date} ${build_sha256} \n$(cat builds.txt)" > builds.txt |
97 | 105 | sort -u -k1,1 -o builds.txt builds.txt |
98 | 106 | 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