diff options
Diffstat (limited to 'ci/buildserver-upload.sh')
| -rwxr-xr-x | ci/buildserver-upload.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ci/buildserver-upload.sh b/ci/buildserver-upload.sh index d9bae81e5b..06ee45ba2b 100755 --- a/ci/buildserver-upload.sh +++ b/ci/buildserver-upload.sh @@ -12,6 +12,14 @@ source "$SCRIPT_DIR/buildserver-config.sh" cd "$UPLOAD_DIR" +function invalidate_bunny_cdn_cache { + curl --request POST \ + --url "https://api.bunny.net/pullzone/${BUNNYCDN_PULL_ZONE_ID}/purgeCache" \ + --header "AccessKey: ${BUNNYCDN_API_KEY}" \ + --header 'content-type: application/json' \ + --fail-with-body +} + function rsync_upload { local file=$1 local upload_dir=$2 @@ -23,6 +31,9 @@ function rsync_upload { while true; do sleep 10 + + should_invalidate_bunny_cdn_cache="false" + for checksums_path in **/*.sha256; do sleep 1 @@ -43,6 +54,7 @@ while true; do upload_path="$platform/builds" else upload_path="$platform/releases" + should_invalidate_bunny_cdn_cache="true" fi # Read all files listed in the checksum file at $checksums_path into an array. @@ -74,4 +86,9 @@ while true; do # shellcheck disable=SC2216 yes | rm "$checksums_path" done + + if [[ "$should_invalidate_bunny_cdn_cache" == "true" ]]; then + echo "Invalidating Bunny CDN cache" + invalidate_bunny_cdn_cache || continue + fi done |
