-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (30 loc) · 925 Bytes
/
cache-bust.yml
File metadata and controls
35 lines (30 loc) · 925 Bytes
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
name: Update Service Worker Cache Version
on:
push:
branches:
- main
paths-ignore:
- ".github/**"
jobs:
cache-bust:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Update service worker cache version
run: |
SHORT_SHA="${GITHUB_SHA::8}"
sed -i "s|^const CACHE_VERSION = .*|const CACHE_VERSION = \"${SHORT_SHA}\";|" sw.js
node scripts/update-version.js
- name: Commit updated build metadata
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add sw.js version.json
if git diff --cached --quiet; then
echo "No changes to commit."
else
git commit -m "chore: update build metadata [skip ci]"
git push
fi