Purge jsDelivr cache
This GitHub action allows purge file cache on jsDelivr CDN side.
Forked from gacts/purge-jsdelivr-cache to allow inputting URLs as a comma delineated list.
jobs:
purge-jsdelivr-cache:
runs-on: ubuntu-20.04
steps:
- uses: egad13/purge-jsdelivr-cache@v1
with:
url: |
https://cdn.jsdelivr.net/npm/jquery@3.2.0/dist/jquery.js
https://cdn.jsdelivr.net/npm/jquery@3.3.0/dist/jquery.min.js
You can also supply multiple URLs in comma delineated strings.
jobs:
purge-jsdelivr-cache:
runs-on: ubuntu-20.04
steps:
- uses: egad13/purge-jsdelivr-cache@v1
with:
url: https://cdn.jsdelivr.net/npm/jquery@3.2.0/dist/jquery.js,https://cdn.jsdelivr.net/npm/jquery@3.3.0/dist/jquery.min.js
This is useful, for example, if you want to generate a list of URLs to purge in a different workflow step.
jobs:
purge-jsdelivr-cache:
runs-on: ubuntu-20.04
steps:
- name: Checkout main
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
# Generates a comma-separated list of URLs for each .js file in the 'dist' directory
- name: Determine CDN URLs to Purge
id: purge_urls
run: |
baseUrl="https://cdn.jsdelivr.net/gh/${{ github.repository }}@latest"
urls=""
for f in `find dist -name "*.js" -type f`; do
urls+="${baseUrl}/${f},"
done
echo "urls=${urls%,*}" >> $GITHUB_OUTPUT
- name: Purge CDN Caches
uses: egad13/purge-jsdelivr-cache@v1
with:
url: ${{ steps.purge_urls.outputs.urls }}
Following inputs can be used as step.with
keys:
Name | Type | Default | Required | Description |
---|---|---|---|---|
url |
string or list |
yes | URLs for the cache purging | |
attempts |
number |
3 | no | Retry attempts (on the request failing) |
New versions releasing scenario:
- Make required changes in the changelog file
- Build the action distribution (
make build
oryarn build
) - Commit and push changes (including
dist
directory changes - this is important) into themaster
branch - Publish new release using repo releases page (git tag should follow
vX.Y.Z
format)
Major and minor git tags (v1
and v1.2
if you publish v1.2.Z
release) will be updated automatically.
If you find any action errors, please, make an issue in the current repository.
This is open-sourced software licensed under the MIT License.