diff --git a/.github/workflows/purge-cache.yml b/.github/workflows/purge-cache.yml new file mode 100644 index 00000000..eab47969 --- /dev/null +++ b/.github/workflows/purge-cache.yml @@ -0,0 +1,33 @@ +name: ♻️ Purge Cloudflare cache + +on: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + deploy: + name: ♻️ Purge Cloudflare cache + runs-on: ubuntu-latest + + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + + - name: 📝 Get changed files + id: changed-files + uses: tj-actions/changed-files@v40.2.1 + with: + path: "./app" + + - name: ♻️ Purge Cloudflare cache + if: ${{ github.ref == 'refs/heads/main' }} && steps.changed-files.outputs.any_changed == 'true' + uses: jakejarvis/cloudflare-purge-action@v0.3.0 + env: + CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }} + CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} + PURGE_URLS: '["https://www.mcan.sh", "https://www.mcan.sh/resume", "https://www.mcan.sh/resume.pdf"]'