initial commit

This commit is contained in:
2026-06-17 22:37:47 +05:30
commit bc31b2508b
100 changed files with 18050 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
# Triggered by the Payload afterChange webhook.
# Pulls the latest source and rebuilds the static site.
set -euo pipefail
REPO_DIR="${REPO_DIR:-/opt/softvowels}"
BRANCH="${BRANCH:-main}"
LOG_FILE="${LOG_FILE:-/var/log/softvowels-rebuild.log}"
cd "$REPO_DIR"
echo "[$(date -Is)] Rebuild start" >> "$LOG_FILE"
if ! git fetch --depth 1 origin "$BRANCH" >> "$LOG_FILE" 2>&1; then
echo "[$(date -Is)] git fetch failed" >> "$LOG_FILE"
exit 1
fi
LOCAL=$(git rev-parse HEAD)
REMOTE=$(git rev-parse "origin/$BRANCH")
if [ "$LOCAL" = "$REMOTE" ]; then
echo "[$(date -Is)] No changes (HEAD=$LOCAL). Skip." >> "$LOG_FILE"
exit 0
fi
git reset --hard "origin/$BRANCH" >> "$LOG_FILE" 2>&1
echo "[$(date -Is)] Updated to $REMOTE" >> "$LOG_FILE"
if command -v pnpm >/dev/null 2>&1; then
PKG=pnpm
elif command -v npm >/dev/null 2>&1; then
PKG="npm run --workspace=web"
else
echo "[$(date -Is)] No package manager found" >> "$LOG_FILE"
exit 2
fi
case "$PKG" in
pnpm)
pnpm install --frozen-lockfile >> "$LOG_FILE" 2>&1
pnpm --filter web build >> "$LOG_FILE" 2>&1
;;
*)
(cd apps/web && npm ci --no-audit --no-fund >> "$LOG_FILE" 2>&1)
(cd apps/web && npm run build >> "$LOG_FILE" 2>&1)
;;
esac
echo "[$(date -Is)] Rebuild done" >> "$LOG_FILE"