#!/usr/bin/env bash # publish.sh — build the artifact that goes into the Steam depot. # Usage: ./scripts/publish.sh [output-dir] (default: artifacts/steam-stage) # # Why a script: the flags below are load-bearing and easy to lose. PublishTrimmed stays OFF # (WPF resolves XAML by reflection), the single-file bundle must extract natives or ffmpeg- # adjacent loading breaks, and ReadyToRun is what keeps startup under a second on a cold # machine. Getting one of them wrong does not fail the build — it fails on a user's PC. # # The output is a folder, not a zip: steamcmd uploads a directory into a depot, and Steam # delivers it. There is no installer, no admin prompt and no self-updater (Steam updates). # # Requires WINDOWS dotnet — see docs/ai/environment.md -> Run. set -euo pipefail DOTNET="/mnt/c/Program Files/dotnet/dotnet.exe" [ -x "$DOTNET" ] || { echo "❌ Windows dotnet not found at $DOTNET"; exit 1; } ROOT="$(cd "$(dirname "$0")/.." && pwd)" OUT_REL="${1:-artifacts/steam-stage}" OUT="$ROOT/$OUT_REL" echo "══ publish ══" rm -rf "$OUT" mkdir -p "$OUT" "$DOTNET" publish "$(wslpath -w "$ROOT/ytLive.csproj")" \ -c Release -r win-x64 --self-contained true \ -p:PublishSingleFile=true \ -p:IncludeNativeLibrariesForSelfExtract=true \ -p:EnableCompressionInSingleFile=true \ -p:PublishReadyToRun=true \ -p:DebugType=none \ --nologo -v minimal \ -o "$(wslpath -w "$OUT")" echo "══ verify the staged artifact ══" fail() { echo "❌ $1" >&2; exit 1; } [ -f "$OUT/LlamaCasty.exe" ] || fail "publish produced no LlamaCasty.exe (AssemblyName reverted?)" [ -d "$OUT/ffmpeg" ] || fail "ffmpeg/ is missing — it must ship beside the exe (docs/ai/output.md)" [ -f "$OUT/LICENSE" ] || fail "LICENSE is missing from the artifact" [ -f "$OUT/PRIVACY.md" ] || fail "PRIVACY.md is missing from the artifact" [ -f "$OUT/THIRD-PARTY-NOTICES.txt" ] || fail "THIRD-PARTY-NOTICES.txt is missing from the artifact" # Test artifacts must never reach a depot: a shipped xunit host is a support ticket. if compgen -G "$OUT/*.Tests.dll" > /dev/null || compgen -G "$OUT/xunit*" > /dev/null; then fail "test assemblies leaked into the publish output" fi # steam_api64.dll arrives with the Steamworks SDK; until then its absence is expected and the # app must fall back to the free profile, so this is a notice, not a failure. if [ ! -f "$OUT/steam_api64.dll" ]; then echo "⚠ steam_api64.dll not staged — the build will run as the free profile only." fi echo "" du -sh "$OUT" | awk '{print " artifact size: " $1}' echo "✓ staged: $OUT_REL" echo "" echo "Next: steamcmd +run_app_build scripts/app_build_.vdf"