diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index beb962938acbe207a6e7884a1fedbcea19c7bdb8..09addc1fb59acb4d4dbfc2ad791e1518ef5081b1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -80,10 +80,30 @@ create-purge-json: tags: - docker script: - - >- - echo -en "{\n \"files\": [\n \"$CI_PAGES_URL/\"" > purge.json; - for d in $(find public/* -type d); do echo -en ",\n \"$CI_PAGES_URL/${d#public/}/\"" >> purge.json; done; - for f in $(find public -type f); do echo -en ",\n \"$CI_PAGES_URL/${f#public/}\"" >> purge.json; done; + - |- + echo -en "{\n \"files\": [" > purge.json + # Add the index-less homepage, with and without trailing slash + 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 - cat purge.json artifacts: