4251b1f40b
Wraps the build-and-push routine (zola build → rsync to mycelium:~/public/praxis/) with --dry-run and --no-build flags. Anchored to repo root via $(dirname).
46 lines
1.0 KiB
Bash
Executable File
46 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build the Zola site and sync `public/` to the Variomedia staging host.
|
|
#
|
|
# Usage:
|
|
# scripts/deploy.sh # build + deploy
|
|
# scripts/deploy.sh --dry-run # show what rsync would do, transfer nothing
|
|
# scripts/deploy.sh --no-build # skip `zola build` (deploy existing public/)
|
|
|
|
set -euo pipefail
|
|
|
|
REMOTE="mycelium:~/public/praxis/"
|
|
LOCAL="public/"
|
|
|
|
# Run from the repo root so relative paths are stable.
|
|
cd "$(dirname "$0")/.."
|
|
|
|
DRY_RUN=""
|
|
DO_BUILD=1
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
--dry-run) DRY_RUN="--dry-run" ;;
|
|
--no-build) DO_BUILD=0 ;;
|
|
-h|--help)
|
|
sed -n '2,8p' "$0"
|
|
exit 0 ;;
|
|
*)
|
|
echo "unknown flag: $arg" >&2
|
|
exit 2 ;;
|
|
esac
|
|
done
|
|
|
|
if [[ "$DO_BUILD" -eq 1 ]]; then
|
|
echo "==> zola build"
|
|
zola build
|
|
fi
|
|
|
|
if [[ ! -d "$LOCAL" ]]; then
|
|
echo "error: $LOCAL does not exist — run without --no-build first" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "==> rsync $LOCAL -> $REMOTE${DRY_RUN:+ (dry-run)}"
|
|
rsync -avz --delete $DRY_RUN "$LOCAL" "$REMOTE"
|
|
|
|
echo "==> done"
|