#!/usr/bin/env bash
set -euo pipefail

SERVER_USER="richard"
SERVER_HOST="192.168.1.168"
SERVER_PATH="/opt/bulloseum/data"

BUILD_DIR="build/web"

mkdir -p "$BUILD_DIR"
godot --headless --export-release "Web" "$BUILD_DIR/index.html"

gzip -kf "$BUILD_DIR/index.wasm"

scp "$BUILD_DIR/index.html" \
    "$BUILD_DIR/index.js" \
    "$BUILD_DIR/index.wasm.gz" \
    "$BUILD_DIR/index.pck" \
    "$BUILD_DIR/index.audio.worklet.js" \
    "$BUILD_DIR/index.audio.position.worklet.js" \
    "$BUILD_DIR/index.icon.png" \
    "$BUILD_DIR/index.apple-touch-icon.png" \
    "$BUILD_DIR/index.png" \
    "$SERVER_USER@$SERVER_HOST:$SERVER_PATH/"

echo "deployed to $SERVER_HOST:$SERVER_PATH"
