Deploy script for server to bust the stupid cache

This commit is contained in:
Dan Baker 2026-02-21 21:34:17 +00:00
parent c115121aa7
commit e5bb396ac6

20
deploy.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/sh
set -e
cd "$(dirname "$0")"
# Reset any previously stamped files so git pull succeeds cleanly
git checkout -- index.html sw.js
git pull
V=$(git rev-parse --short HEAD)
# Stamp asset query strings in index.html
sed -i 's|href="style\.css[^"]*"|href="style.css?v='"$V"'"|' index.html
sed -i 's|src="script\.js[^"]*"|src="script.js?v='"$V"'"|' index.html
# Bump service worker cache name
sed -i "s/status-poster-v[^']*/status-poster-$V/" sw.js
echo "Deployed $V"