Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Purge Front Door Cache action #87

Merged
merged 4 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/purge_cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Purge Front Door Cache

on:
# Run this workflow from other workflows
workflow_call:
inputs:
fdname:
description: 'Front Door Name'
required: true
type: string
path:
description: 'Content path to purge'
required: true
type: string
secrets:
creds:
required: true

jobs:
purge_cache:
runs-on: ubuntu-latest
steps:
- name: Log in
uses: azure/login@v2
with:
creds: ${{ secrets.creds }}

- name: Purge Cache Path
id: upload
uses: azure/CLI@v2
with:
inlineScript: |
az network front-door purge-endpoint \
--resource-group 'static-sites' \
--name '${{ inputs.fdname }}' \
--content-paths '${{ inputs.path }}'
15 changes: 15 additions & 0 deletions .github/workflows/test_cache_purge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Test Cache Purge

on:
pull_request:
workflow_dispatch:

jobs:
test_cache_purge:
name: Purge cached file
uses: ./.github/workflows/purge_cache.yaml
with:
fdname: 'frontend-preview-zooniverse-org'
path: '/assets/star.jpg'
secrets:
creds: ${{ secrets.AZURE_STATIC_SITES }}
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,25 @@ jobs:
creds: ${{ secrets.AZURE_STATIC_SITES }}
```

### Purge the Front Door cache for a specific AFD instance and content path
```yaml
name: Purge Star
on:
push:
tags:
- production-release
jobs:
purge_cached_star:
name: Purge cached file
uses: zooniverse/ci-cd/.github/workflows/purge_cache.yaml@main
with:
fdname: 'frontend-preview-zooniverse-org'
path: '/assets/star.jpg'
secrets:
creds: ${{ secrets.AZURE_STATIC_SITES }}
```

### Send a Slack notification
```yaml
slack_notification:
Expand Down