niwanetwork / niwa-website

The official website for the Nintendo Independent Wiki Alliance
https://niwanetwork.org
9 stars 15 forks source link

GitHub Action to purge Cloudflare cache #59

Closed KevinPayravi closed 2 years ago

KevinPayravi commented 3 years ago

Our CSS + images are currently cached by Cloudflare, which means any changes we make to our CSS or existing images may take several hours to go into effect. Images aren't a big deal, but for site updates that rely on an updated style.css, things can look broken as we wait for cache to purge.

A solution is creating a GitHub Action that submits a purge request to Cloudflare for style.css every time we merge something into master. There are several existing actions out there (e.g. cloudflare-cache-purge-action) we can leverage. Doing this requires our Cloudflare API key, so this is dependent on Bulbapedia agreeing to this.

KevinPayravi commented 2 years ago

Completed with help from BulbaTech for Cloudflare access. We now have a GitHub action that purges our stylesheet; whenever something is pushed to the master branch, this purge action will be queued pending my approval. Approval is required as the Cloudflare key has been added to a new prod environment, and any workflow that runs in the prod environment will require approval by me to prevent any misuse by anyone with write access to the repository.

Unfortunately there isn't a great way to purge all the images unless we list out all the individual URLs; purging by prefix requires an enterprise account.