blob: 65cec98a84e7a8bd2a17ce56594b0fda404de185 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/usr/bin/env bash
# Runs INSIDE the gitweb container (uid 1000) on git-http-backend pushes.
# Only writes a signal into the bare repo; the host systemd path unit
# (/home/somhairle/git/blog.git/deploy.signal) picks it up and builds.
set -u
ZERO=0000000000000000000000000000000000000000
GITDIR=$(git rev-parse --git-dir 2>/dev/null) || exit 0
while read -r oldrev newrev refname; do
case "$refname" in
refs/heads/main)
if [ "$newrev" != "$ZERO" ]; then
if printf '%s %s\n' "$newrev" "$(date -u +%FT%TZ)" > "$GITDIR/deploy.signal" 2>/dev/null; then
echo "blog-deploy: build signal written for $newrev" >&2
else
echo "blog-deploy: WARNING could not write deploy.signal" >&2
fi
fi
;;
esac
done
exit 0
|