-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (42 loc) · 1.2 KB
/
jsdelivr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Purge JSdelivr Cache
on:
push:
branches:
- main
- master
- develop
workflow_dispatch:
jobs:
purge:
runs-on: ubuntu-latest
steps:
- name: Checkout main
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Determine CDN URLs to Purge
id: purge_urls
run: |
baseUrl="https://cdn.jsdelivr.net/gh/${{ github.repository }}@main"
urls=""
for f in `find scripts -name "*.js" -type f`; do
urls+="${baseUrl}/${f},"
done
for f in `find styles -name "*.css" -type f`; do
urls+="${baseUrl}/${f},"
done
for f in `find styles -name "*.css.map" -type f`; do
urls+="${baseUrl}/${f},"
done
for f in `find images -name "*.png" -type f`; do
urls+="${baseUrl}/${f},"
done
for f in `find images -name "*.jpg" -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 }}
attempts: 5