adrian-altner.de/scripts/publish-projects.sh
Adrian Altner 0f43bb18cc Add deployment scripts for blog, links, notes, photos, and projects; implement history squashing and vision processing
- Created `publish-blog.sh`, `publish-links.sh`, `publish-notes.sh`, `publish-photos.sh`, and `publish-projects.sh` for deploying respective content to the VPS.
- Implemented `squash-history.sh` to replace the entire git history with a single commit.
- Added `vision.ts` and `vision.spec.ts` for processing images with AI, including metadata extraction and merging.
- Enhanced error handling and logging in vision processing scripts.
2026-04-21 23:17:21 +02:00

49 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Usage: publish-projects.sh [vps-host] [branch]
# Can be called from any directory — no dependency on the repo being the working dir.
set -euo pipefail
VAULT_PROJECTS='/Users/adrian/Obsidian/Web/adrian-altner-com/content/projects'
VPS="${1:-hetzner}"
REMOTE_BRANCH="${2:-main}"
REMOTE_BASE='/opt/websites/www.adrian-altner.de'
REMOTE_PROJECTS="${REMOTE_BASE}/src/content/projects"
# --- 1. Sync vault to VPS ---
ssh "$VPS" "
set -euo pipefail
cd '$REMOTE_BASE'
git fetch --prune origin '$REMOTE_BRANCH'
git checkout '$REMOTE_BRANCH'
git reset --hard 'origin/$REMOTE_BRANCH'
git clean -fd -e .env -e .env.production
mkdir -p '$REMOTE_PROJECTS'
"
rsync -az --delete \
--include='*/' \
--include='*.md' \
--include='*.mdx' \
--include='*.jpg' \
--include='*.jpeg' \
--include='*.JPG' \
--include='*.JPEG' \
--include='*.png' \
--include='*.PNG' \
--include='*.webp' \
--include='*.gif' \
--exclude='.DS_Store' \
--exclude='*' \
"$VAULT_PROJECTS/" "$VPS:$REMOTE_PROJECTS/"
# --- 2. Build + cleanup ---
ssh "$VPS" "
set -euo pipefail
cd '$REMOTE_BASE'
podman-compose -f compose.yml up --build -d --force-recreate
podman image prune -af
podman builder prune -af
"
echo "Projects deploy done via $VPS (branch: $REMOTE_BRANCH)."