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

Include all URLs for a page when purging the cache

parent 7ead1a03
Branches
No related tags found
No related merge requests found
...@@ -80,10 +80,30 @@ create-purge-json: ...@@ -80,10 +80,30 @@ create-purge-json:
tags: tags:
- docker - docker
script: script:
- >- - |-
echo -en "{\n \"files\": [\n \"$CI_PAGES_URL/\"" > purge.json; echo -en "{\n \"files\": [" > purge.json
for d in $(find public/* -type d); do echo -en ",\n \"$CI_PAGES_URL/${d#public/}/\"" >> purge.json; done; # Add the index-less homepage, with and without trailing slash
for f in $(find public -type f); do echo -en ",\n \"$CI_PAGES_URL/${f#public/}\"" >> purge.json; done; echo -en "\n \"$CI_PAGES_URL\"" >> purge.json
echo -en ",\n \"$CI_PAGES_URL/\"" >> purge.json
# Add all the directories, with and without trailing slash
for d in $(find public/* -type d); do
echo -en ",\n \"$CI_PAGES_URL/${d#public/}\"" >> purge.json
echo -en ",\n \"$CI_PAGES_URL/${d#public/}/\"" >> purge.json
done
# Add all the non-HTML files, with and without trailing slash
for f in $(find public -type f -not -iname '*.html'); do
echo -en ",\n \"$CI_PAGES_URL/${f#public/}\"" >> purge.json
echo -en ",\n \"$CI_PAGES_URL/${f#public/}/\"" >> purge.json
done
# Add all the HTML files, with and without trailing slash. First with file
# extension, then without
for f in $(find public -type f -iname '*.html'); do
echo -en ",\n \"$CI_PAGES_URL/${f#public/}\"" >> purge.json
echo -en ",\n \"$CI_PAGES_URL/${f#public/}/\"" >> purge.json
f="${f%.html}"
echo -en ",\n \"$CI_PAGES_URL/${f#public/}\"" >> purge.json
echo -en ",\n \"$CI_PAGES_URL/${f#public/}/\"" >> purge.json
done
echo -e "\n ]\n}" >> purge.json echo -e "\n ]\n}" >> purge.json
- cat purge.json - cat purge.json
artifacts: artifacts:
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment