Deploy script for server to bust the stupid cache
This commit is contained in:
parent
c115121aa7
commit
e5bb396ac6
1 changed files with 20 additions and 0 deletions
20
deploy.sh
Executable file
20
deploy.sh
Executable 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"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue