status-poster/deploy.sh

20 lines
477 B
Bash
Executable file

#!/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"