Skip to content
Snippets Groups Projects
Verified Commit 172b4914 authored by Chris Coley's avatar Chris Coley
Browse files

Purge all site URLs from Cloudflare cache

parent 2d0983fc
Branches
No related tags found
No related merge requests found
......@@ -70,4 +70,26 @@ pages:
rules:
- if: $CI_COMMIT_BRANCH == 'custom-domain'
# Purge all of this site's URLs from the Cloudflare cache
purge-cache:
stage: .post
tags:
- docker
rules:
- if: $CF_PURGE_CACHE_ZONE && $CF_PURGE_CACHE_TOKEN
script:
- >-
FILES="{ \"files\": [\"$CI_PAGES_URL/\"";
for d in $(find public/* -type d); do FILES="$FILES,\"$CI_PAGES_URL/${d#public/}/\""; done;
for f in $(find public -type f); do FILES="$FILES,\"$CI_PAGES_URL/${f#public/}\""; done;
FILES="$FILES] }"
- echo $FILES
- >-
wget -qO- "https://api.cloudflare.com/client/v4/zones/$CF_PURGE_CACHE_ZONE/purge_cache"
--header "Content-Type: application/json"
--header "Authorization: Bearer $CF_PURGE_CACHE_TOKEN"
--post-data "$FILES"
# vi: set ts=2 sw=2 et ft=yaml:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment