#!/bin/bash
set -e

SLUG="billable-hour"
DECK="ai-killed-the-billable-hour"
SRC="$(cd "$(dirname "$0")" && pwd)"
SHARE="$HOME/Work/upshift/upshift-share"
DEST="$SHARE/public/$SLUG"

# Build HTML and PDF
echo "Building deck..."
"$SRC/build.sh" "$DECK.md" html
"$SRC/build.sh" "$DECK.md" pdf

# Copy assets
echo "Deploying to $DEST..."
mkdir -p "$DEST/fonts" "$DEST/images"
cp "$SRC/$DECK.html" "$DEST/index.html"
cp "$SRC/$DECK.pdf" "$DEST/$DECK.pdf"
cp "$SRC/logo.svg" "$DEST/"
cp "$SRC/analytics.js" "$DEST/"
cp "$SRC/fonts/"*.woff2 "$DEST/fonts/"
cp "$SRC/images/office-windows-night.jpg" \
   "$SRC/images/skyscraper-dark.jpg" \
   "$SRC/images/city-dawn.jpg" \
   "$DEST/images/"

# Post-process: inject meta tags, analytics, scripts
node "$SRC/postprocess.mjs" "$DEST/index.html"

echo ""
echo "Deployed to $DEST"
echo "Next: cd $SHARE && git add public/$SLUG && git commit -m 'Update $SLUG deck' && git push"
