feat: add Bulwark Lite build for Stalwart Applications

This commit is contained in:
Linus Rath
2026-09-19 00:53:53 +02:00
parent 2d4a562432
commit fdfcb1711e
30 changed files with 2267 additions and 84 deletions
+72 -10
View File
@@ -2,9 +2,16 @@ name: Build Static Lite
# Bulwark Lite: the static export of the webmail (see docs in README.md,
# "Static Lite build"). Runs the build on every push as a regression check,
# attaches the zip to releases, and lets maintainers build a custom variant
# attaches the zips to releases, and lets maintainers build a custom variant
# (fixed server URL, sub-path mount, locale subset, demo) on demand.
#
# Two targets are built side by side:
# - static: bulwark-lite-<version>.zip for any static web host;
# - stalwart: bulwark-lite-stalwart.zip, a Stalwart `Application` bundle. Its
# release asset name carries no version, so
# releases/latest/download/bulwark-lite-stalwart.zip is a stable
# resourceUrl that follows new releases.
#
# scripts/lite/prepare.mjs deletes the server-only trees in place; that is
# safe here because the Actions checkout is disposable (CI=true is the guard).
@@ -17,14 +24,14 @@ on:
workflow_dispatch:
inputs:
jmap_server_url:
description: "Default JMAP server URL baked into config.json (editable after download)"
description: "Default JMAP server URL baked into config.json (static: editable after download; stalwart: leave empty for the serving Stalwart)"
required: false
app_name:
description: "App name"
required: false
default: "Bulwark Webmail"
base_path:
description: "Sub-path mount, e.g. /webmail (baked into asset URLs)"
description: "Sub-path mount for the static target, e.g. /webmail (baked into asset URLs; the stalwart target ignores it)"
required: false
locales:
description: "Comma-separated locale subset, e.g. en,de,fr (default: all)"
@@ -41,6 +48,10 @@ jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
target: [static, stalwart]
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -58,7 +69,9 @@ jobs:
env:
CI: "true"
GIT_COMMIT: ${{ github.sha }}
NEXT_PUBLIC_BASE_PATH: ${{ inputs.base_path }}
LITE_TARGET: ${{ matrix.target }}
# The Stalwart bundle learns its mount prefix at runtime.
NEXT_PUBLIC_BASE_PATH: ${{ matrix.target == 'static' && inputs.base_path || '' }}
LITE_JMAP_SERVER_URL: ${{ inputs.jmap_server_url }}
LITE_APP_NAME: ${{ inputs.app_name }}
LITE_LOCALES: ${{ inputs.locales }}
@@ -69,13 +82,19 @@ jobs:
env:
REF_NAME: ${{ github.ref_name }}
run: |
if [ "${{ github.event_name }}" = "release" ]; then
VERSION="${REF_NAME#v}"
if [ "${{ matrix.target }}" = "stalwart" ]; then
# postbuild already packed it (entries at the archive root, no
# wrapping folder); the name stays version-less on purpose.
ZIP="bulwark-lite-stalwart.zip"
else
VERSION="$(cat VERSION)-${GITHUB_SHA::7}"
if [ "${{ github.event_name }}" = "release" ]; then
VERSION="${REF_NAME#v}"
else
VERSION="$(cat VERSION)-${GITHUB_SHA::7}"
fi
ZIP="bulwark-lite-${VERSION}.zip"
(cd out && zip -qr "../${ZIP}" .)
fi
ZIP="bulwark-lite-${VERSION}.zip"
(cd out && zip -qr "../${ZIP}" .)
echo "ZIP=${ZIP}" >> "$GITHUB_ENV"
ls -la "${ZIP}"
@@ -90,7 +109,7 @@ jobs:
if: github.event_name != 'release'
uses: actions/upload-artifact@v4
with:
name: bulwark-lite
name: bulwark-lite-${{ matrix.target }}
path: ${{ env.ZIP }}
retention-days: 7
@@ -137,3 +156,46 @@ jobs:
name: lite-smoke-report
path: playwright-report
retention-days: 7
smoke-stalwart:
# The Stalwart Application bundle, served by scripts/lite/serve.mjs
# --stalwart (an emulation of how Stalwart serves Applications) from the
# zip itself, under two prefixes.
runs-on: ubuntu-latest
timeout-minutes: 30
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Install Playwright browser
run: npx playwright install --with-deps chromium
- name: Build demo bundle
env:
CI: "true"
GIT_COMMIT: ${{ github.sha }}
LITE_TARGET: stalwart
LITE_DEMO_MODE: "true"
LITE_LOCALES: "en,de"
run: npm run build:lite
- name: Run smoke test
run: npm run test:lite-smoke:stalwart
- name: Upload Playwright report
if: failure()
uses: actions/upload-artifact@v4
with:
name: lite-smoke-stalwart-report
path: playwright-report
retention-days: 7