git clone https://garage44.eu/jeroen/cartopolis.git.. /.forgejo/workflows/deploy-web.yml
name: Deploy web UI
# Build the atlas web UI (crates/atlas/web) and publish it as
# https://cartopolis.org/ โ the site root. It was a separate repository's deploy, to
# web.cartopolis.org, until 2026-09.
#
# The build is Bun over ~35 KB of TypeScript, it takes seconds, and publishing
# static files interrupts nobody โ unlike the simulator or atlas, nothing restarts.
#
# **Manual since 2026-10-16**: `midas deploy web` is the usual path (it builds
# on a workshop node from deploy/build/web.sh, the same steps as below, and publishes
# in about 80 s); this workflow is the fallback for when the workshop is down. It ran
# on every push to `main` that touched the web UI before.
on:
workflow_dispatch:
concurrency:
group: deploy-web
cancel-in-progress: true
jobs:
deploy:
name: build & publish the web UI
runs-on: ubuntu-latest
container:
# The image carries Bun already (`tools/*.ts` are Bun scripts).
image: cartopolis-ci:latest
# Caddy serves this directory as cartopolis.org/. It is in the runner's
# `valid_volumes` from when the separate repository published it.
options: >-
--volume /data/cartopolis/admin:/publish
--volume /data/ci-cache/cargo-registry-web:/root/.cargo/registry
defaults:
run:
working-directory: crates/atlas/web
steps:
- uses: actions/checkout@v4
# `--frozen-lockfile`: a deploy must build what was reviewed.
- name: Install dependencies
run: bun install --frozen-lockfile
# The chat engine: Rust to WebAssembly (`build-chat-core.ts`), required โ
# the chat page (`/chat`) is nothing without it. Nightly because that is
# the toolchain this image carries the wasm32 target for (deploy-wasm uses
# it too); the module itself needs no nightly feature. The step checks the
# image's wasm-bindgen against Cargo.lock first, and that pin has drifted
# before: a mismatch fails here, saying which version to install.
- name: Build the chat engine
env:
RUSTUP_TOOLCHAIN: nightly
run: bun run build:chat-core
# Both gates before the build, so a red one costs seconds rather than a
# published site nobody checked. `tsc` earns its keep: `src/types.ts`
# describes Rust structs by hand and nothing else checks them.
- name: Typecheck
run: bun x tsc --noEmit
- name: Typecheck the chat worker
run: bun x tsc --noEmit -p tsconfig.worker.json
- name: Test
run: bun test
# The call files this page imports (`src/lib/call.ts`): the browser's
# SFrame against the native vectors, and its codec choice.
- name: Test the call files
run: bun test ../../cartopolis/web
- name: Build
run: bun run build.ts --require-chat
# `--delete`, so a file dropped from the build does not linger on the site.
- name: Publish
run: |
command -v rsync >/dev/null || { apt-get update -qq && apt-get install -y -qq rsync >/dev/null; }
rsync -a --delete dist/ /publish/
echo "published $(du -sh /publish | cut -f1) to /data/cartopolis/admin"