summaryrefslogtreecommitdiff
path: root/examples/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hooks')
-rwxr-xr-xexamples/hooks/caddy-deploy.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/hooks/caddy-deploy.sh b/examples/hooks/caddy-deploy.sh
index 7f2173b..ed05f20 100755
--- a/examples/hooks/caddy-deploy.sh
+++ b/examples/hooks/caddy-deploy.sh
@@ -5,8 +5,9 @@
# Supports wildcard hosting domains and custom primary domains with redirects.
#
# Env vars from Witryna (automatic):
-# WITRYNA_SITE — site name
-# WITRYNA_PUBLIC_DIR — stable "current" symlink path (document root)
+# WITRYNA_SITE — site name
+# WITRYNA_PUBLIC_DIR — stable "current" symlink path (document root)
+# WITRYNA_BUILD_STATUS — build outcome: "success" or "failed"
#
# Env vars from [sites.env] in witryna.toml:
# BASE_DOMAIN — wildcard hosting domain (e.g. mywitrynahost.com)
@@ -37,6 +38,12 @@
set -eu
+# Only configure Caddy on successful builds
+if [ "${WITRYNA_BUILD_STATUS:-}" = "failed" ]; then
+ echo "Build failed — skipping Caddy configuration"
+ exit 0
+fi
+
SITES_DIR="${CADDY_SITES_DIR:-/etc/caddy/sites.d}"
CADDY_CONFIG="${CADDY_CONFIG:-/etc/caddy/Caddyfile}"