ci: add HealthChat desktop build pipeline

This commit is contained in:
2026-06-06 15:13:59 +02:00
parent 2fb8a2c92c
commit 5f09f58a82
5 changed files with 364 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
#
# Build the HealthChat desktop webapp directory: the fork's element-web build with
# the HealthChat plugin artifacts injected at modules/. The result is written to
# apps/desktop/webapp so it can either be:
# - packed locally with `pnpm --dir apps/desktop run asar-webapp` (after copying
# element.io/healthchat/config.json over webapp/config.json), or
# - uploaded as the `webapp-artifact` consumed by build_desktop_prepare.yaml
# (which overlays element.io/healthchat/config.json and packs the asar for you).
#
# Plugin artifacts are taken from $PLUGIN_DIST (default: ./plugin-dist at repo root),
# expecting:
# $PLUGIN_DIST/healthchat-module.js
# $PLUGIN_DIST/elements/healthchat-elements.js
# Build them first from the healthchat-workspace element-plugin:
# (cd element-plugin && npm ci && npm run build)
# (cd element-plugin/module && npm ci && npm run build)
# then stage main.js -> healthchat-elements.js (see build-healthchat-desktop.yaml).
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
cd "$REPO_ROOT"
PLUGIN_DIST="${PLUGIN_DIST:-plugin-dist}"
WEBAPP_SRC="apps/web/webapp"
WEBAPP_DEST="apps/desktop/webapp"
if [ ! -f "$PLUGIN_DIST/healthchat-module.js" ] || [ ! -f "$PLUGIN_DIST/elements/healthchat-elements.js" ]; then
echo "error: missing plugin artifacts under '$PLUGIN_DIST'." >&2
echo " expected:" >&2
echo " $PLUGIN_DIST/healthchat-module.js" >&2
echo " $PLUGIN_DIST/elements/healthchat-elements.js" >&2
exit 1
fi
echo "Building fork element-web webapp..."
VERSION="${VERSION:-$(git describe --abbrev=0 --tags 2>/dev/null || echo 0.0.0)}"
VERSION="$VERSION" pnpm --dir apps/web build
echo "Injecting HealthChat plugin into $WEBAPP_DEST/modules ..."
rm -rf "$WEBAPP_DEST"
cp -R "$WEBAPP_SRC" "$WEBAPP_DEST"
mkdir -p "$WEBAPP_DEST/modules/elements"
cp "$PLUGIN_DIST/healthchat-module.js" "$WEBAPP_DEST/modules/healthchat-module.js"
cp "$PLUGIN_DIST/elements/healthchat-elements.js" "$WEBAPP_DEST/modules/elements/healthchat-elements.js"
echo "Done -> $WEBAPP_DEST"
echo
echo "To produce webapp.asar locally:"
echo " cp apps/desktop/element.io/healthchat/config.json $WEBAPP_DEST/config.json"
echo " pnpm --dir apps/desktop run asar-webapp"