-
Notifications
You must be signed in to change notification settings - Fork 209
47 lines (43 loc) · 1.53 KB
/
cloudflare-clear-cache-s3-dir.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Cloudflare Purge Cache for Directory
on:
workflow_call:
inputs:
s3-url:
description: S3 URL
required: true
type: string
workflow_dispatch:
inputs:
s3-url:
description: S3 URL
required: false
type: string
default: /snapshot/TOOLS/sts4/nightly/e4.32/
env:
AWS_ACCESS_KEY_ID: ${{ secrets.CDN_S3_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CDN_S3_SECRET_KEY }}
AWS_DEFAULT_REGION: us-east-1
AWS_ENDPOINT_URL_S3: ${{ secrets.CDN_S3_ENDPOINT }}
AWS_S3_BUCKET: ${{ secrets.CDN_BUCKET }}/spring-tools
DOWNLOAD_URL_ROOT: https://cdn.spring.io/spring-tools
jobs:
clear-cache-s3-dir:
runs-on: ubuntu-latest
steps:
- name: Prepare URLs
id: prepare-urls
run: |
ESCAPED_REPLACE_URL=$(printf '%s\n' "$DOWNLOAD_URL_ROOT/" | sed -e 's/[\/&]/\\&/g')
sed_pattern="s/^[ \t]*/$ESCAPED_REPLACE_URL/"
urls=`aws s3 ls s3://$AWS_S3_BUCKET${{ inputs.s3-url }} --recursive | awk '{$1=$2=$3=""; print $0}' | sed -e "$sed_pattern" | paste -sd' ' -`
echo "urls=$urls" >> $GITHUB_OUTPUT
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
with:
sparse-checkout: |
.github
- uses: ./.github/actions/cloudflare-purge
name: Invalidate Cache for URLs
with:
urls: ${{ steps.prepare-urls.outputs.urls }}
cloudflare_zone_id: ${{ secrets.CLOUDFLARE_ZONE_ID }}
cloudflare_cache_token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}