summaryrefslogtreecommitdiff
path: root/examples/hooks
diff options
context:
space:
mode:
authorDawid Rycerz <dawid@rycerz.xyz>2026-02-15 21:27:00 +0100
committerDawid Rycerz <dawid@rycerz.xyz>2026-02-15 21:27:00 +0100
commitce0dbf6b249956700c6a1705bf4ad85a09d53e8c (patch)
treed7c3236807cfbf75d7f3a355eb5df5a5e2cc4ad7 /examples/hooks
parent064a1d01c5c14f5ecc032fa9b8346a4a88b893f6 (diff)
feat: witryna 0.2.0HEADv0.2.0main
Switch, cleanup, and status CLI commands. Persistent build state via state.json. Post-deploy hooks on success and failure with WITRYNA_BUILD_STATUS. Dependency diet (axum→tiny_http, clap→argh, tracing→log). Drop built-in rate limiting. Nix flake with NixOS module. Arch Linux PKGBUILD. Centralized version management. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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}"