From 5d36957c99b5b546a404a4cd7c6cf7cde05d012e Mon Sep 17 00:00:00 2001 From: Alex Bates Date: Tue, 26 Sep 2023 09:48:27 +0100 Subject: [PATCH] purge Cloudflare cache after deployments --- .github/workflows/deploy.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..c3899c40 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,20 @@ +name: Deploy + +on: + push: + branches: + - main + +jobs: + purge_cache: + name: Purge Cloudflare cache + runs-on: ubuntu-latest + steps: + - name: Sleep to allow Pages to build + run: sleep 60 + - name: Purge cache + run: | + curl --request POST \ + --url https://api.cloudflare.com/client/v4/zones/2ab0c67ef74c8cb12474c3f7d76b1ac1/purge_cache \ + --header 'Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}' \ + --data '{ "purge_everything": true }'