diff --git a/scripts/build-macos-universal.sh b/scripts/build-macos-universal.sh index da4f9d4..b2c7332 100644 --- a/scripts/build-macos-universal.sh +++ b/scripts/build-macos-universal.sh @@ -15,7 +15,20 @@ export MESHCHATX_SKIP_BACKEND_MANIFEST=1 pnpm run electron-postinstall pnpm run version:sync -pnpm run build-frontend +# Skip frontend rebuild when CI provides a prebuilt meshchatx/public artifact +# via the reusable Frontend build workflow. Local invocations leave the flag +# unset and continue to build everything from source. +if [[ "${MESHCHATX_FRONTEND_PREBUILT:-0}" != "1" ]]; then + pnpm run build-frontend + pnpm run build-docs +else + if [[ ! -f "meshchatx/public/index.html" ]]; then + echo "MESHCHATX_FRONTEND_PREBUILT=1 but meshchatx/public/index.html is missing." >&2 + echo "Download the frontend artifact into meshchatx/public/ before invoking this script." >&2 + exit 1 + fi + echo "Reusing prebuilt frontend assets in meshchatx/public/." +fi cross-env ARCH=arm64 pnpm run build-backend if [[ -n "${PYTHON_CMD_X64:-}" ]]; then cross-env ARCH=x64 PYTHON_CMD="$PYTHON_CMD_X64" pnpm run build-backend diff --git a/scripts/ci/github-build-windows.sh b/scripts/ci/github-build-windows.sh index 7317e32..287dfb7 100755 --- a/scripts/ci/github-build-windows.sh +++ b/scripts/ci/github-build-windows.sh @@ -1,5 +1,10 @@ #!/usr/bin/env bash -# Build Windows portable + NSIS installers (electron-builder). See package.json dist:windows. +# Build Windows portable + NSIS installers (electron-builder). +# +# When MESHCHATX_FRONTEND_PREBUILT=1 the script reuses the prebuilt +# meshchatx/public/ artifact downloaded from the reusable Frontend build +# workflow and only rebuilds the cx_Freeze backend. Otherwise it falls back to +# the full pnpm dist:windows pipeline (frontend + docs + backend). set -euo pipefail ROOT="$(cd "$(dirname "$0")/../.." && pwd)" @@ -7,4 +12,13 @@ cd "$ROOT" git config --global core.longpaths true 2>/dev/null || true -pnpm run dist:windows +if [[ "${MESHCHATX_FRONTEND_PREBUILT:-0}" == "1" ]]; then + if [[ ! -f "meshchatx/public/index.html" ]]; then + echo "MESHCHATX_FRONTEND_PREBUILT=1 but meshchatx/public/index.html is missing." >&2 + echo "Download the frontend artifact into meshchatx/public/ before invoking this script." >&2 + exit 1 + fi + pnpm run dist:windows-prebuilt +else + pnpm run dist:windows +fi