Thin build repo behind COA: builds a community's branded Matou installers from a kit and publishes them as Releases (Matou/coa ADR 0004/0010).
Find a file
2026-10-21 00:16:44 -05:00
.forgejo/workflows mac stage: build the two macOS DMGs on the Mac runner (Matou/coa#169) 2026-09-28 16:53:18 -05:00
.github/workflows build: retention-days 1 on every artifact upload 2026-09-18 23:31:34 -05:00
docs/deployment docs: what's needed to enable push notifications in coa builds 2026-09-04 05:50:46 -05:00
fixture coa-builds: kit-driven build workflow, MATOU_APP_REF, fixture kit (coa #80, phase-3 plan Task 12) 2026-08-31 20:26:08 -05:00
fixture-smoke phase 4: pin matou-app v0.6.7 (feature flags); smoke kit disables chat (coa#138) 2026-09-05 22:37:58 -05:00
scripts/forgejo coa builds: desktop version <matou-app>-build.<N>; upload latest.yml + latest-linux.yml after the installers 2026-10-07 01:23:43 -05:00
MATOU_APP_REF chore: pin MATOU_APP_REF to matou-app v0.8.10 (update banner clears the Android status bar, matou-app #746) 2026-10-21 00:16:44 -05:00
README.md mac stage: README + an offline test of the gate, the dispatch and the bounded wait 2026-09-28 16:55:40 -05:00

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:

  1. After prepare, build.yml dispatches build-mac.yml with the same inputs, the matou-app ref it resolved, and a start_deadline (10 minutes on, MAC_START_WINDOW).
  2. The Mac builds <slug>-<ver>-mac-x64.dmg and -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 after start_deadline skips itself, green.
  3. build.yml uploads 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 for MAC_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> is matou until 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, header x-coa-signature: sha256=<hex HMAC-SHA256 of the raw body with BUILD_WEBHOOK_SECRET>. Body is a @coa/schema BuildComplete:
    • 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}

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 host make rebuild SLUG=<slug> for each community that should pick it up (each rebuild is a new build number → a new Release; old Releases stay).

  • Manual / smoke run (a kit that is not served by COA). This repo is private, so raw.githubusercontent.com URLs into it 404 for the plain curl the kit job uses — host the two kit files somewhere public instead. fixture-smoke/ (slug composite-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_REF
    

    matou_ref must be a full sha or a branch/tag name (a short sha cannot be fetched). The real proof (COA phase-3 plan Task 19) uses kit_url=https://coa.matou.nz/c/<slug> and callback_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 next build=1 can be created. fixture/ (slug ngati-example) is the kit the COA server itself proves with — do not reuse its slug for smoke runs, the Release name collides with the real coa-ngati-example-vN builds.

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).