#!/bin/sh
set -eu

ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
OUTPUT_PATH="${1:-$ROOT_DIR/release-artifact.tar}"

cd "$ROOT_DIR/apps/web"
npm ci
npm run build

cd "$ROOT_DIR"
tar --exclude=.git --exclude=apps/web/node_modules -cf "$OUTPUT_PATH" .

echo "Release artifact written to $OUTPUT_PATH"
