#!/usr/bin/env bash # Build locally and push the static site to the droplet. # Usage: deploy/deploy.sh set -euo pipefail HOST="${1:?usage: deploy.sh }" npm run check npm test npm run build # Old hashed chunks stay a week: a page loaded before this deploy can still # fetch the module it was built against instead of failing mid-duel. rsync -az --delete --filter='P _app/immutable/*' \ build/ "root@$HOST:/opt/waving-hands/build/" ssh "root@$HOST" ' find /opt/waving-hands/build/_app/immutable -type f -mtime +7 -delete chown -R root:caddy /opt/waving-hands chmod -R g+rX /opt/waving-hands systemctl reload caddy systemctl --no-pager -l status caddy | head -3 ' echo "deployed."