- Shell 100%
| .forgejo/workflows | ||
| .github/workflows | ||
| docs/deployment | ||
| fixture | ||
| fixture-smoke | ||
| scripts/forgejo | ||
| MATOU_APP_REF | ||
| README.md | ||
coa-builds
The thin build repo behind COA — Matou/coa ADR 0004. It owns
no app code: one workflow_dispatch workflow checks out
matou-collective/matou-app at
MATOU_APP_REF, fetches a community's kit (kit.json + logo) from the COA server,
runs matou-app's own npm run kit:apply, builds the five installers with no publishing
and no Apple/Windows signing, publishes them as a GitHub Release, and posts a signed
callback to COA. Nothing here is a fork; when matou-app moves, bump MATOU_APP_REF.
Two build paths
| Forgejo (current) | GitHub (fallback) | |
|---|---|---|
| Workflow | .forgejo/workflows/build.yml + build-mac.yml → scripts/forgejo/coa-build.sh |
.github/workflows/build.yml |
| Runs on | our runners: bens-mac-04 (Ubuntu, host mode, Docker) and, for macOS, macos-x64 (an Intel Mac, host mode) |
GitHub-hosted runners |
| Builds | Linux AppImage, Windows installer (wine container), Android APK; the two macOS DMGs when the Mac is there | all five |
| Publishes | uploads to the COA server (PUT /api/build-upload/…, signed), served at coa.matou.nz/dl/<slug>/v<build>/… — the forge's uplink is too slow for 150 MB downloads |
a GitHub Release (private repo: links 404 for the public) |
| Hand-off between steps | one work dir on one host — no Actions artifacts | Actions artifacts (retention-days: 1) |
Why: on 2026-09-19 the GitHub org's Actions storage quota blocked every build, and it
does not clear by deleting artifacts (Matou/coa ADR 0010, GOTCHAS 22). The COA server
chooses the path with COA_BUILDS_PROVIDER (mds coa_builds_provider).
Forgejo specifics. One build at a time. The job installs its own Go
(~/go-sdk) and Android toolchain (~/.matou-android, ~3 GB, first run only) into the
runner user's home, and caches npm/electron downloads in ~/coa-builds-cache. Forgejo
has no job-log API, so each build also writes ~/coa-builds-logs/<tag>.log on the host
(newest 30 kept) — read it with ssh when a run fails. Secrets on the Forgejo side:
BUILD_WEBHOOK_SECRET (signs both the uploads and the callback) and the four
ANDROID_* values (org- or repo-level). A proof run that builds everything and
publishes nowhere: slug=composite-smoke kit_url=fixture-smoke build=1 callback_url=none.
macOS. The Mac runner is a laptop — asleep or away some of the time — so the two DMGs are optional and the build never depends on them:
- After
prepare,build.ymldispatchesbuild-mac.ymlwith the same inputs, the matou-app ref it resolved, and astart_deadline(10 minutes on,MAC_START_WINDOW). - The Mac builds
<slug>-<ver>-mac-x64.dmgand-mac-arm64.dmg(unsigned; arm64 is a cross-build on the Intel host, so its backend is format-checked, not run) and uploads them to the COA server itself. It never sends a callback. A job it picks up afterstart_deadlineskips itself, green. build.ymluploads its three installers, then waits for the DMGs to be served at/dl/…: until both are there, until the Mac build ends, until the start deadline passes with no runner having taken the job, or forMAC_WAIT_MAX(40 minutes) at most. The callback lists the DMGs that arrived; a missing one renders "coming soon" on the community page.
It is a separate workflow because a job that waits for an absent runner inside the
build run would keep that run alive, and the coa-build concurrency group would then
queue every later build behind it. The COA server refuses uploads for a build that
has already reported (409), which is why the DMGs must arrive before the callback and
why a late Mac stops quietly. On the Mac everything lives in ~/coa-builds/
(COA_BASE): work dir, caches, Go and coa-builds-logs/<tag>.log. Dispatching uses
the job's own token; set the MAC_DISPATCH_TOKEN secret to override it, or
MAC_BUILD=off to build without macOS. A Mac-only proof run: dispatch build-mac.yml
with the proof inputs above and no start_deadline.
Layout
| Path | What |
|---|---|
.forgejo/workflows/build.yml, build-mac.yml |
the Forgejo build and its macOS half |
scripts/forgejo/coa-build.sh |
every stage of both, one script |
.github/workflows/build.yml |
the GitHub workflow — jobs kit → desktop (mac-x64, mac-arm64, linux, windows) + android → release / failed |
MATOU_APP_REF |
the matou-app ref every build uses unless matou_ref is passed (main until matou-app v0.5.0 is tagged — COA #79 door 18a-v) |
fixture/kit.json, fixture/logo.svg |
FIXTURE_KIT / FIXTURE_LOGO_SVG from @coa/schema — the ngati-example kit used to prove the workflow |
Inputs (workflow_dispatch)
| Input | Example | Notes |
|---|---|---|
slug |
ngati-example |
must equal kit.json's slug |
kit_url |
https://coa.matou.nz/c/ngati-example |
${kit_url}/kit.json and ${kit_url}/<logoFile> are fetched |
build |
1 |
positive integer; must equal kit.json's build; becomes Android versionCode and the Release tag coa-<slug>-v<build> |
config_url |
https://coa-infra.matou.nz/ngati-example |
baked in as VITE_PROD_CONFIG_URL |
callback_url |
https://coa.matou.nz/api/build-complete |
receives the signed BuildComplete body |
matou_ref |
v0.5.0 |
optional override of MATOU_APP_REF |
Builds for the same slug are serialised (concurrency: build-<slug>), never cancelled.
Outputs
- Release
coa-<slug>-v<build>with exactly five assets: the four electron-builder artefacts exactly as matou-app names them (today<base>-<version>-darwin-x64.dmg,-darwin-arm64.dmg,-linux.AppImage,-win32.exe— electron-builder's${platform};<base>ismatouuntil kit plan Task 3 switches it to the slug) plus<slug>-<version>-android.apk. The callback's asset URLs are derived from the real filenames (*-x64.dmg,*-arm64.dmg,*.AppImage,*.exe,*.apk), so a naming change in matou-app never breaks the callback. - Callback —
POST ${callback_url},content-type: application/json, headerx-coa-signature: sha256=<hex HMAC-SHA256 of the raw body with BUILD_WEBHOOK_SECRET>. Body is a@coa/schemaBuildComplete:- success:
{outcome:"success", slug, build, runUrl, releaseUrl, assets:{"mac-x64","mac-arm64","linux-appimage","windows","android"}}(asset values are the Release download URLs) - failure (any job failed or was cancelled):
{outcome:"failure", slug, build, runUrl, error}
- success:
Secrets (Actions secrets on this repo — COA #79)
| Secret | Used by |
|---|---|
BUILD_WEBHOOK_SECRET |
callback HMAC — same value as the COA server's BUILD_WEBHOOK_SECRET |
ANDROID_KEYSTORE_B64, ANDROID_KEYSTORE_PASSWORD, ANDROID_KEY_ALIAS, ANDROID_KEY_PASSWORD |
signing the release APK (matou-app's MATOU_KEYSTORE_* contract) |
Dispatching needs a fine-grained PAT with Actions: write + Contents: read on this
repo — the COA server holds it as GITHUB_DISPATCH_TOKEN. Values never appear in this
repo, the tracker or a chat transcript.
Operating it
-
New matou-app release: tag matou-app, write the tag into
MATOU_APP_REF, commit, then on the COA hostmake rebuild SLUG=<slug>for each community that should pick it up (each rebuild is a newbuildnumber → a new Release; old Releases stay). -
Manual / smoke run (a kit that is not served by COA). This repo is private, so
raw.githubusercontent.comURLs into it 404 for the plaincurlthekitjob uses — host the two kit files somewhere public instead.fixture-smoke/(slugcomposite-smoke, build 1) exists for exactly this; a public gist works:gh gist create --public fixture-smoke/kit.json fixture-smoke/logo.svg # prints the gist URL gh workflow run build.yml --repo matou-collective/coa-builds \ -f slug=composite-smoke \ -f kit_url=https://gist.githubusercontent.com/<user>/<gist-id>/raw \ -f build=1 \ -f config_url=https://coa-infra.matou.nz/ngati-example \ -f callback_url=https://httpbin.org/post \ -f matou_ref=<matou-app sha or branch> # optional; default MATOU_APP_REFmatou_refmust be a full sha or a branch/tag name (a short sha cannot be fetched). The real proof (COA phase-3 plan Task 19) useskit_url=https://coa.matou.nz/c/<slug>andcallback_url=https://coa.matou.nz/api/build-complete. Delete the smoke Release (gh release delete coa-composite-smoke-v1 --cleanup-tag) and the gist after a manual run so the nextbuild=1can be created.fixture/(slugngati-example) is the kit the COA server itself proves with — do not reuse its slug for smoke runs, the Release name collides with the realcoa-ngati-example-vNbuilds.
Out of scope
Apple notarisation / Windows code signing, the auto-update feed (COA builds ship with updates off), and any per-community feature toggles (COA phase 4).