commit
Document the monorepo: layout, releasing, Manager manifest
Co-Authored-By: Claude Opus 5.5 <[email protected]>
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..432d6f5
--- /dev/null
+++ b/README.md
@@ -0,0 +1,42 @@
+# Doughmination apps
+
+The Android apps, in one Gradle build. The servers they talk to live in their
+own repositories (the mail server is [doughmination/email](https://github.com/doughmination/email)).
+
+| App | Directory | Gradle module | Application ID | Workflow |
+|---|---|---|---|---|
+| Device Reporter | [`api-helper/`](api-helper/) | `:api-helper:app` | `uk.doughmination.devicereporter` | `device-reporter.yml` |
+| Inbox | [`email/`](email/) | `:email:app` | `gay.doughmination.mail` | `inbox.yml` |
+| Doughmination Manager | [`doughmination-manager/`](doughmination-manager/) | `:doughmination-manager:app` | `gay.doughmination.manager` | `manager.yml` |
+| Plural | [`plural/`](plural/) | `:plural:app` | `gay.doughmination.plural` | `plural.yml` |
+
+Doughmination Manager and Plural are placeholders for now: they build and run,
+and nothing else.
+
+## Layout
+
+```
+settings.gradle.kts every app module is included here
+build.gradle.kts plugin versions (apply false)
+gradle/libs.versions.toml one version catalog: SDK levels, plugins, libraries
+<app>/app/ one Android application module per app
+docs/releasing.md tags, version codes, signing, CI secrets
+docs/manifest.md the Doughmination Manager's manifest format
+.github/workflows/ one workflow per app, sharing android-app.yml
+```
+
+The apps share the build and the catalog, never each other's code: no app
+depends on another, and each keeps its own namespace, application ID,
+resources and signing key.
+
+## Building
+
+Needs JDK 17–21 (Gradle 8.11 doesn't run on newer ones) and the Android SDK
+(platform 35), with `sdk.dir` in `local.properties`.
+
+```sh
+./gradlew :email:app:assembleDebug # one app
+./gradlew assembleDebug # all of them
+```
+
+Releases are built by CI; see [docs/releasing.md](docs/releasing.md).
diff --git a/api-helper/README.md b/api-helper/README.md
index b98bdb3..d0e22bb 100644
--- a/api-helper/README.md
+++ b/api-helper/README.md
@@ -83,53 +83,33 @@ doughnut family's: bat-winged doughnut over a phone sending signal. The source a
## Getting the APK
-There's no Android Studio needed — GitHub builds it for you.
+There's no Android Studio needed — GitHub builds it for you. Device Reporter lives in the
+[doughmination/apps](https://github.com/doughmination/apps) monorepo, and its workflow is
+`.github/workflows/device-reporter.yml`.
-**Quick test build:** every push runs the workflow and produces a debug APK. Open the run
-under the **Actions** tab and download the **device-reporter-debug-apk** artifact. Good for
-trying things out; signed with Android's throwaway debug key.
+**Quick test build:** every push to `main` that touches `api-helper/` runs the workflow and
+uploads an APK. Open the run under the **Actions** tab and download the
+**device-reporter-…** artifact. Good for trying things out.
-**Proper signed release:** go to the **Actions** tab → **Build APK** → **Run workflow**, type
-a version like `v1.0.0` in the box, and run it. GitHub builds a signed APK, creates that tag,
-and publishes it as the latest Release. This is the one to actually keep on your phone.
-(If you'd rather, pushing a `v*` tag from your terminal does the exact same thing.)
+**Proper signed release:** go to the **Actions** tab → **Device Reporter** → **Run workflow**,
+type a version like `v2.1.0` in the box, and run it. GitHub builds a signed APK, creates the
+`device-reporter-v2.1.0` tag, and publishes it as a Release. This is the one to actually keep
+on your phone. (Pushing a `device-reporter-v2.1.0` tag from your terminal does the same.)
-A minute later, your repo's **Releases** page has `device-reporter-v1.0.0.apk` sitting at the
-top marked "Latest". Download it straight onto the phone.
+A minute later the repo's **Releases** page has `device-reporter-2.1.0.apk`. Download it
+straight onto the phone. Version codes, tags and the signing secrets
+(`DEVICE_REPORTER_*`) are covered in [docs/releasing.md](../docs/releasing.md).
-### One-time signing setup
-
-You need a keystore (your personal signing key) and four repo secrets. Make the keystore once:
-
-```bash
-keytool -genkeypair -v \
- -keystore release.keystore \
- -alias device-reporter \
- -keyalg RSA -keysize 2048 -validity 10000
-```
-
-It'll ask for a password and a few details — remember the password. Then base64-encode the
-keystore so it can live in a secret:
-
-```bash
-base64 -i release.keystore | pbcopy # macOS: now in your clipboard
-```
-
-In your repo, go to **Settings → Secrets and variables → Actions** and add four secrets:
-
-- `SIGNING_KEYSTORE_BASE64` — paste the base64 blob from above.
-- `SIGNING_STORE_PASSWORD` — the keystore password.
-- `SIGNING_KEY_ALIAS` — `device-reporter` (or whatever `-alias` you used).
-- `SIGNING_KEY_PASSWORD` — the key password (same as the store password unless you set a separate one).
-
-Keep `release.keystore` itself safe and out of git — losing it means you can't ship signed
-updates that install over an existing copy. That's it; tag a version and the release builds itself.
+Keep the keystore safe and out of git — losing it means you can't ship signed updates that
+install over an existing copy.
### Building locally instead
+From the repo root:
+
```bash
-./gradlew assembleDebug # app/build/outputs/apk/debug/app-debug.apk
-./gradlew assembleRelease # falls back to the debug key if no signing secrets are set
+./gradlew :api-helper:app:assembleDebug # api-helper/app/build/outputs/apk/debug/app-debug.apk
+./gradlew :api-helper:app:assembleRelease # falls back to the debug key if no SIGNING_* variables are set
```
## Installing on the phone
@@ -152,5 +132,6 @@ app/src/main/java/uk/doughmination/devicereporter/
ReporterService.kt the always-on service: event triggers + 5-minute alarm
BootReceiver.kt brings the service back after a reboot or app update
art/icon.svg launcher icon source; render-icons.sh rebuilds the PNGs
-.github/workflows/build.yml builds the debug APK and publishes signed releases
```
+
+Gradle and its version catalog are shared with the other apps from the repository root.
diff --git a/api-helper/art/render-icons.sh b/api-helper/art/render-icons.sh
index 0e087e7..d3d93df 100755
--- a/api-helper/art/render-icons.sh
+++ b/api-helper/art/render-icons.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Renders art/icon.svg into the adaptive launcher foreground at every density.
-# Needs rsvg-convert (librsvg). Run from the repo root: ./art/render-icons.sh
+# Needs rsvg-convert (librsvg). Run from api-helper/: ./art/render-icons.sh
set -euo pipefail
res=app/src/main/res
diff --git a/docs/manifest.md b/docs/manifest.md
new file mode 100644
index 0000000..10b51cb
--- /dev/null
+++ b/docs/manifest.md
@@ -0,0 +1,86 @@
+# Doughmination Manager manifest (proposed, v1)
+
+**Status: proposal.** Nothing serves this yet and the Manager doesn't read it
+yet. Where it's hosted, and what builds it, is up to the existing backend; this
+only fixes the shape so the app and whatever produces it agree.
+
+The Manager fetches one JSON document from a fixed URL. Publishing a new
+version of any app means updating that document; the Manager itself never needs
+rebuilding for it.
+
+```json
+{
+ "schemaVersion": 1,
+ "generatedAt": "2026-11-02T12:00:00Z",
+ "apps": [
+ {
+ "id": "inbox",
+ "packageName": "gay.doughmination.mail",
+ "name": "Inbox",
+ "summary": "Mail for every doughmination domain.",
+ "iconUrl": "https://…/inbox.png",
+ "signingCertSha256": ["AB:CD:…"],
+ "latest": {
+ "versionCode": 112,
+ "versionName": "1.2.0",
+ "apkUrl": "https://…/inbox-1.2.0.apk",
+ "sha256": "…",
+ "sizeBytes": 8123456,
+ "minSdk": 26,
+ "releasedAt": "2026-11-02T12:00:00Z",
+ "releaseNotes": "Markdown.",
+ "releaseUrl": "https://github.com/doughmination/apps/releases/tag/inbox-v1.2.0"
+ }
+ }
+ ]
+}
+```
+
+## Fields
+
+| Field | Required | Notes |
+|---|---|---|
+| `schemaVersion` | yes | `1`. The Manager refuses a major version it doesn't know. |
+| `apps[].id` | yes | Stable, URL-safe. Never reused. |
+| `apps[].packageName` | yes | The applicationId; how the Manager finds the installed copy. |
+| `apps[].name`, `summary`, `iconUrl` | name yes | For the list. |
+| `apps[].signingCertSha256` | yes | SHA-256 of the signing certificate(s), as `apksigner verify --print-certs` prints them. The Manager won't install an APK signed by anything else. |
+| `latest.versionCode` | yes | Compared with the installed `longVersionCode`. |
+| `latest.versionName` | yes | Shown to people. |
+| `latest.apkUrl` | yes | HTTPS. |
+| `latest.sha256`, `sizeBytes` | yes | Checked after download, before installing. |
+| `latest.minSdk` | no | Lets the Manager hide apps the phone can't run. |
+| `latest.releasedAt`, `releaseNotes`, `releaseUrl` | no | Shown on the app's page. |
+
+The Manager lists itself in `apps` like any other app, which is how it updates
+itself.
+
+## Where the values come from
+
+Every release CI publishes carries `<artifact>-<version>.json` beside the APK
+(see [releasing.md](releasing.md)):
+
+```json
+{
+ "packageName": "gay.doughmination.mail",
+ "versionCode": 112,
+ "versionName": "1.2.0",
+ "file": "inbox-1.2.0.apk",
+ "sha256": "…",
+ "sizeBytes": 8123456,
+ "commit": "…"
+}
+```
+
+That covers `latest` apart from the URLs and notes. The rest (`name`, `summary`,
+`iconUrl`, `signingCertSha256`) changes rarely and can sit in whatever
+generates the manifest.
+
+## Open questions
+
+- Where the manifest is served from, and whether APKs stay on GitHub Releases.
+- Whether the manifest should be signed (e.g. a detached signature checked
+ against a key built into the Manager). The per-app certificate check already
+ stops a tampered manifest from installing a foreign APK, but not from
+ offering an old version.
+- Release channels (beta) are left out of v1.
diff --git a/docs/releasing.md b/docs/releasing.md
new file mode 100644
index 0000000..9577192
--- /dev/null
+++ b/docs/releasing.md
@@ -0,0 +1,91 @@
+# Releasing
+
+Each app releases on its own: a tag for one app builds and publishes only that
+app. All of it runs in `.github/workflows/android-app.yml`, called by each
+app's workflow.
+
+## When CI runs
+
+An app's workflow runs when a push to `main` (or a pull request) touches its
+directory, the shared Gradle files (`gradle/`, `*.gradle.kts`,
+`gradle.properties`, `gradlew*`), or its workflow, and whenever its release tag
+is pushed. Every run builds the release APK and uploads it as a run artifact.
+
+| App | Release tag | Also |
+|---|---|---|
+| Device Reporter | `device-reporter-v2.1.0` | "Run workflow" with a version creates the tag |
+| Inbox | `inbox-v1.2.0` | every build from `main` replaces the `inbox-latest` release |
+| Doughmination Manager | `manager-v0.1.0` | "Run workflow" with a version creates the tag |
+| Plural | `plural-v0.1.0` | "Run workflow" with a version creates the tag |
+
+```sh
+git tag inbox-v1.2.0 && git push origin inbox-v1.2.0
+```
+
+Releases are never marked as the repository's "Latest" (only one release can
+be, and there are several apps). Link to a specific tag instead, as the mail
+site's `/download` does with `inbox-latest`.
+
+Each release carries the APK (`inbox-1.2.0.apk`) and a metadata file next to
+it (`inbox-1.2.0.json`) with the package name, version code and name, SHA-256
+and size, for building the Manager manifest ([manifest.md](manifest.md)).
+
+## Version codes
+
+Android only installs an update whose `versionCode` is higher than the
+installed one, so CI sets it:
+
+```
+versionCode = 100 + the workflow's run number
+versionName = the tag's version (1.2.0), or <prefix>.<versionCode> for untagged builds
+```
+
+The base of 100 keeps every app above the builds it shipped before moving here
+(Inbox reached 7 in doughmination/email, Device Reporter 2 in
+doughmination/api-helper). Run numbers only ever go up, but they belong to the
+workflow file: **if you rename or recreate a workflow, raise its
+`version_code_base` above the last code it published**. Local builds use the
+fallbacks in each `build.gradle.kts`, which are lower, so a local build won't
+install over a CI one.
+
+## Signing
+
+Every app keeps its own key for good. An APK signed with any other key can't
+be installed over an existing install, so losing a key means users have to
+uninstall first. Keystores never go in git (`*.jks`, `*.keystore` and
+`keystore.properties` are ignored); keep them backed up.
+
+The apps read their key two ways, as they did before the move:
+
+- **Inbox** reads `email/keystore.properties` (`storeFile` is relative to
+ `email/`). Its key alias is `inbox`.
+- **Device Reporter, Manager, Plural** read `SIGNING_STORE_FILE`,
+ `SIGNING_STORE_PASSWORD`, `SIGNING_KEY_ALIAS`, `SIGNING_KEY_PASSWORD`, and use
+ the debug key when they're not set.
+
+Pull requests build unsigned or debug-signed. Anything published (a tag, a
+manual release, `inbox-latest`) fails rather than ship without the real key.
+
+### Repository secrets
+
+Set them with `gh secret set NAME -R doughmination/apps < file` (or paste the
+value when it asks). Base64 a keystore with `base64 -w0 key.jks`.
+
+| Secret | App | Value |
+|---|---|---|
+| `INBOX_KEYSTORE_BASE64` | Inbox | base64 of `inbox.jks` |
+| `INBOX_KEYSTORE_PASSWORD` | Inbox | its store (and key) password |
+| `INBOX_GOOGLE_SERVICES_JSON` | Inbox | optional; base64 of `google-services.json`, overrides the committed one |
+| `DEVICE_REPORTER_KEYSTORE_BASE64` | Device Reporter | base64 of its keystore |
+| `DEVICE_REPORTER_STORE_PASSWORD` | Device Reporter | store password |
+| `DEVICE_REPORTER_KEY_ALIAS` | Device Reporter | key alias |
+| `DEVICE_REPORTER_KEY_PASSWORD` | Device Reporter | key password |
+| `MANAGER_*`, `PLURAL_*` | Manager, Plural | same four as Device Reporter, once they have keys |
+| `CODEBERG_USERNAME`, `CODEBERG_REPO`, `CODEBERG_TOKEN` | all | the Codeberg mirror (`codeberg.yml`) |
+
+Make a new app's key once, and back it up before its first release:
+
+```sh
+keytool -genkeypair -v -keystore manager.jks -alias manager \
+ -keyalg RSA -keysize 4096 -validity 10000
+```
diff --git a/email/README.md b/email/README.md
index b976361..02d88d8 100644
--- a/email/README.md
+++ b/email/README.md
@@ -1,6 +1,6 @@
# Inbox for Android
-A native Android app (Kotlin, Jetpack Compose) for [Inbox](../email). It talks
+A native Android app (Kotlin, Jetpack Compose) for [Inbox](https://github.com/doughmination/email). It talks
to the same Worker API as the web app.
```
@@ -12,7 +12,7 @@ app/src/main/java/gay/doughmination/mail/
Auth.kt sign-in through the SSO in a browser tab (code + PKCE)
TokenStore.kt session token, encrypted with an Android Keystore key
Live.kt the /api/live WebSocket while the app is open
- Models.kt mirrors email/src/shared/types.ts
+ Models.kt mirrors src/shared/types.ts in doughmination/email
ui/
MailViewModel.kt state and actions for every screen
ThreadListScreen folders, swipe actions, long-press menu
@@ -36,23 +36,22 @@ app/src/main/java/gay/doughmination/mail/
## Building
-Needs JDK 17–21 (Gradle 8.11 doesn't run on newer JDKs) and the Android SDK
-(platform 35).
+From the repository root (see [the root README](../README.md) for JDK and SDK):
```sh
-echo "sdk.dir=/opt/android-sdk" > local.properties
-./gradlew assembleDebug # app/build/outputs/apk/debug/app-debug.apk
-./gradlew assembleRelease # app/build/outputs/apk/release/app-release.apk
+./gradlew :email:app:assembleDebug # email/app/build/outputs/apk/debug/app-debug.apk
+./gradlew :email:app:assembleRelease # email/app/build/outputs/apk/release/app-release.apk
```
`-PinboxUrl=http://10.0.2.2:5173` points a build at `npm run dev` from the
emulator. Signing in locally needs `/auth/*` to reach that server too.
Notifications need Firebase: put the project's `google-services.json` at
-`app/google-services.json` (next to `app/build.gradle.kts`). Without it the app
-still builds, with notifications off and Settings saying so.
+`email/app/google-services.json` (next to its `build.gradle.kts`). Without it
+the app still builds, with notifications off and Settings saying so.
-Signing reads `keystore.properties` (gitignored):
+Signing reads `email/keystore.properties` (gitignored), with `storeFile`
+relative to `email/`:
```properties
storeFile=inbox.jks
@@ -67,13 +66,14 @@ changing too.
## CI
-`.github/workflows/android.yml` (at the repo root) builds whenever `app/`
-changes and uploads the APK, named by version (`inbox-1.0.6.apk`), as an
-artifact. Each build from `main` replaces the rolling `latest` release, which
-the site's `/download` link redirects to, and pushing a `v1.2.0` tag attaches
-`inbox-1.2.0.apk` to a GitHub release of its own. It signs with two repository secrets:
+`.github/workflows/inbox.yml` builds whenever `email/` (or the shared Gradle
+setup) changes and uploads the APK, named by version (`inbox-1.0.112.apk`), as
+an artifact. Each build from `main` replaces the rolling `inbox-latest`
+release, which the mail site's `/download` link redirects to, and pushing an
+`inbox-v1.2.0` tag attaches `inbox-1.2.0.apk` to a release of its own. Secrets
+(`INBOX_KEYSTORE_BASE64`, `INBOX_KEYSTORE_PASSWORD`, optionally
+`INBOX_GOOGLE_SERVICES_JSON`) and version codes are in
+[docs/releasing.md](../docs/releasing.md).
-- `KEYSTORE_BASE64`: `base64 -w0 inbox.jks`
-- `KEYSTORE_PASSWORD`: the keystore password
-- `GOOGLE_SERVICES_JSON` (optional): `base64 -w0 google-services.json`, if you'd
- rather not commit the file
+Builds up to 1.0.7 were released from doughmination/email; they're still on
+its releases page, and these install over them.