#!/usr/bin/env bash # Runs on `git push`. If a tag ref is among what's being pushed, build locally # and deploy to the server. Normal branch pushes are untouched. set -euo pipefail deploy=0 tag="" while read -r local_ref _local_sha _remote_ref _remote_sha; do case "$local_ref" in refs/tags/*) deploy=1 tag="${local_ref#refs/tags/}" ;; esac done if [ "$deploy" = "1" ]; then echo "→ Tag '$tag' is being pushed — building locally and deploying to the server…" exec "$(git rev-parse --show-toplevel)/scripts/deploy.sh" fi exit 0