diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..dfddf8e --- /dev/null +++ b/deploy.sh @@ -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"