commit
One workflow, one rolling release, one version for every app
apps.yml replaces the six per-app workflows. Every push to main builds all four apps, each with its own key, and replaces the single 'latest' release with system.apk, inbox.apk, device-reporter.apk and doughmination-manager.apk (plus versions.json), so the download links never change. All apps share one version: appVersion in gradle.properties (2.1) plus the build number; version codes are 1000 + the build number. The emulator test of the System app runs after every build.
diff --git a/.github/scripts/build-apps.sh b/.github/scripts/build-apps.sh
new file mode 100644
index 0000000..beeaeed
--- /dev/null
+++ b/.github/scripts/build-apps.sh
@@ -0,0 +1,57 @@
+#!/usr/bin/env bash
+# Builds every app's release APK, each signed with its own key, into <out>
+# under a fixed name (system.apk, inbox.apk, ...), and writes <out>/versions.json
+# describing them. VERSION_NAME and VERSION_CODE come from the environment and
+# are the same for every app.
+#
+# build-apps.sh <out>
+#
+# Keys are read from $KEYS/<app>.p12 with their passwords in the environment
+# (see apps.yml). Without a key an app builds with the debug key (Inbox:
+# unsigned), which is fine for pull requests and never published.
+set -euo pipefail
+
+out=$1
+keys=${KEYS:-${RUNNER_TEMP:-/tmp}/keys}
+mkdir -p "$out"
+manifest="[]"
+
+# build <file name> <gradle module> <module dir> <package> <key name> <password> <alias>
+build() {
+ local file=$1 module=$2 dir=$3 package=$4 key=$5 password=$6 alias=$7
+ echo "::group::$file ($module)"
+ if [ -n "$password" ] && [ -f "$keys/$key.p12" ]; then
+ SIGNING_STORE_FILE="$keys/$key.p12" \
+ SIGNING_STORE_PASSWORD="$password" \
+ SIGNING_KEY_ALIAS="$alias" \
+ SIGNING_KEY_PASSWORD="$password" \
+ ./gradlew "$module:assembleRelease" --console=plain
+ else
+ ./gradlew "$module:assembleRelease" --console=plain
+ fi
+ local apk
+ apk=$(ls "$dir"/build/outputs/apk/release/*.apk | head -1)
+ cp "$apk" "$out/$file"
+ manifest=$(jq \
+ --arg file "$file" \
+ --arg packageName "$package" \
+ --argjson versionCode "${VERSION_CODE:-1}" \
+ --arg versionName "${VERSION_NAME:-dev}" \
+ --arg sha256 "$(sha256sum "$out/$file" | cut -d' ' -f1)" \
+ --argjson sizeBytes "$(stat -c %s "$out/$file")" \
+ '. + [{$file, $packageName, $versionCode, $versionName, $sha256, $sizeBytes}]' <<< "$manifest")
+ echo "::endgroup::"
+}
+
+# Inbox reads email/keystore.properties (written by apps.yml), not SIGNING_*.
+build system.apk ":plural:app" plural/app gay.doughmination.plural plural "${PLURAL_PASSWORD:-}" plural
+build inbox.apk ":email:app" email/app gay.doughmination.mail inbox "${INBOX_PASSWORD:-}" inbox
+build device-reporter.apk ":api-helper:app" api-helper/app uk.doughmination.devicereporter device-reporter "${DEVICE_REPORTER_PASSWORD:-}" "${DEVICE_REPORTER_ALIAS:-device-reporter}"
+build doughmination-manager.apk ":doughmination-manager:app" doughmination-manager/app gay.doughmination.manager manager "${MANAGER_PASSWORD:-}" manager
+
+jq -n \
+ --arg version "${VERSION_NAME:-dev}" \
+ --arg commit "${GITHUB_SHA:-}" \
+ --argjson apps "$manifest" \
+ '{$version, $commit, $apps}' > "$out/versions.json"
+cat "$out/versions.json"
diff --git a/.github/workflows/android-app.yml b/.github/workflows/android-app.yml
deleted file mode 100644
index fefd473..0000000
--- a/.github/workflows/android-app.yml
+++ /dev/null
@@ -1,241 +0,0 @@
-# Builds, signs and publishes one app. Each app's own workflow (inbox.yml,
-# device-reporter.yml, ...) decides when to run and calls this with its details.
-# See docs/releasing.md for tags, version codes and signing.
-name: Android app
-
-on:
- workflow_call:
- inputs:
- app:
- description: Display name, used in release titles ("Inbox").
- type: string
- required: true
- module:
- description: Gradle path of the app module (":email:app").
- type: string
- required: true
- module_dir:
- description: Directory of that module ("email/app").
- type: string
- required: true
- package_name:
- description: applicationId, written into the release metadata.
- type: string
- required: true
- artifact:
- description: File name prefix for the APK ("inbox" -> inbox-1.2.0.apk).
- type: string
- required: true
- tag_prefix:
- description: Release tags look like <tag_prefix><version> ("inbox-v").
- type: string
- required: true
- version_code_base:
- description: Added to the run number so versionCode stays above every earlier build.
- type: number
- required: true
- dev_version_prefix:
- description: Untagged builds are named <prefix>.<versionCode>.
- type: string
- default: "1.0"
- signing:
- description: >
- How the app's Gradle build reads its key: "properties" writes
- <properties_dir>/keystore.properties, "env" sets SIGNING_* variables.
- type: string
- default: env
- properties_dir:
- type: string
- default: ""
- key_alias:
- description: Key alias, unless the key_alias secret is set.
- type: string
- default: ""
- google_services_path:
- description: Where google-services.json goes, if the secret is set.
- type: string
- default: ""
- rolling_tag:
- description: If set, every build from main replaces this release.
- type: string
- default: ""
- release_version:
- description: Manual release version ("v1.2.0"); creates the tag.
- type: string
- default: ""
- secrets:
- keystore_base64:
- required: false
- store_password:
- required: false
- key_alias:
- required: false
- key_password:
- required: false
- google_services_json:
- required: false
-
-jobs:
- build:
- runs-on: ubuntu-latest
- permissions:
- contents: write
- env:
- HAS_SIGNING_KEY: ${{ secrets.keystore_base64 != '' }}
- IS_TAG: ${{ startsWith(github.ref, format('refs/tags/{0}', inputs.tag_prefix)) }}
- IS_MANUAL_RELEASE: ${{ inputs.release_version != '' }}
- IS_ROLLING: ${{ inputs.rolling_tag != '' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
- steps:
- - uses: actions/checkout@v4
- with:
- fetch-depth: 0 # tags, for scoping release notes
-
- - uses: actions/setup-java@v4
- with:
- distribution: temurin
- java-version: 17
-
- - uses: gradle/actions/setup-gradle@v4
-
- - name: Version
- env:
- REF_NAME: ${{ github.ref_name }}
- PREFIX: ${{ inputs.tag_prefix }}
- MANUAL: ${{ inputs.release_version }}
- BASE: ${{ inputs.version_code_base }}
- DEV_PREFIX: ${{ inputs.dev_version_prefix }}
- EVENT: ${{ github.event_name }}
- run: |
- code=$((BASE + GITHUB_RUN_NUMBER))
- if [ "$IS_TAG" = true ]; then
- name=${REF_NAME#"$PREFIX"}
- tag=$REF_NAME
- elif [ -n "$MANUAL" ]; then
- name=${MANUAL#v}
- tag="$PREFIX$name"
- elif [ "$EVENT" != pull_request ] && [ "$GITHUB_REF" = refs/heads/main ]; then
- # Every build from main is released, named by its version code.
- name="$DEV_PREFIX.$code"
- tag="$PREFIX$name"
- else
- name="$DEV_PREFIX.$code"
- tag=""
- fi
- echo "VERSION_CODE=$code" >> "$GITHUB_ENV"
- echo "VERSION_NAME=$name" >> "$GITHUB_ENV"
- echo "RELEASE_TAG=$tag" >> "$GITHUB_ENV"
- echo "versionCode $code, versionName $name ${tag:+(release $tag)}"
-
- # Anything published must be signed with the app's own key, or it can't
- # install over earlier builds; say so rather than quietly skipping.
- - name: Require signing key
- if: (env.RELEASE_TAG != '' || env.IS_ROLLING == 'true') && env.HAS_SIGNING_KEY != 'true'
- run: |
- echo "::error::The signing secrets for ${{ inputs.app }} aren't set on this repository, so no release can be built. See docs/releasing.md."
- exit 1
-
- # Pull requests from forks get no secrets, so they build unsigned (or
- # with the debug key, depending on the app).
- - name: Restore signing key
- if: env.HAS_SIGNING_KEY == 'true'
- env:
- KEYSTORE_BASE64: ${{ secrets.keystore_base64 }}
- STORE_PASSWORD: ${{ secrets.store_password }}
- KEY_ALIAS: ${{ secrets.key_alias || inputs.key_alias }}
- KEY_PASSWORD: ${{ secrets.key_password || secrets.store_password }}
- MODE: ${{ inputs.signing }}
- PROPS_DIR: ${{ inputs.properties_dir }}
- run: |
- store="$RUNNER_TEMP/release.p12"
- echo "$KEYSTORE_BASE64" | base64 -d > "$store"
- if [ "$MODE" = properties ]; then
- umask 077
- printf 'storeFile=%s\nstorePassword=%s\nkeyAlias=%s\nkeyPassword=%s\n' \
- "$store" "$STORE_PASSWORD" "$KEY_ALIAS" "$KEY_PASSWORD" > "$PROPS_DIR/keystore.properties"
- else
- {
- echo "SIGNING_STORE_FILE=$store"
- echo "SIGNING_STORE_PASSWORD=$STORE_PASSWORD"
- echo "SIGNING_KEY_ALIAS=$KEY_ALIAS"
- echo "SIGNING_KEY_PASSWORD=$KEY_PASSWORD"
- } >> "$GITHUB_ENV"
- fi
-
- - name: Restore Firebase config
- env:
- GOOGLE_SERVICES_JSON: ${{ secrets.google_services_json }}
- DEST: ${{ inputs.google_services_path }}
- if: env.GOOGLE_SERVICES_JSON != '' && inputs.google_services_path != ''
- run: echo "$GOOGLE_SERVICES_JSON" | base64 -d > "$DEST"
-
- - name: Build
- run: ./gradlew "${{ inputs.module }}:assembleRelease" --console=plain
-
- - name: Name APK and write release metadata
- env:
- MODULE_DIR: ${{ inputs.module_dir }}
- ARTIFACT: ${{ inputs.artifact }}
- PACKAGE: ${{ inputs.package_name }}
- run: |
- mkdir -p dist
- src=$(ls "$MODULE_DIR"/build/outputs/apk/release/*.apk)
- apk="dist/$ARTIFACT-$VERSION_NAME.apk"
- meta="dist/$ARTIFACT-$VERSION_NAME.json"
- mv "$src" "$apk"
- # Read by whatever builds the Doughmination Manager manifest (docs/manifest.md).
- jq -n \
- --arg packageName "$PACKAGE" \
- --argjson versionCode "$VERSION_CODE" \
- --arg versionName "$VERSION_NAME" \
- --arg file "$(basename "$apk")" \
- --arg sha256 "$(sha256sum "$apk" | cut -d' ' -f1)" \
- --argjson sizeBytes "$(stat -c %s "$apk")" \
- --arg commit "$GITHUB_SHA" \
- '{$packageName, $versionCode, $versionName, $file, $sha256, $sizeBytes, $commit}' > "$meta"
- cat "$meta"
- echo "APK=$apk" >> "$GITHUB_ENV"
- echo "META=$meta" >> "$GITHUB_ENV"
-
- # Fails if the APK isn't validly signed, and prints the certificate so it
- # can be checked against docs/releasing.md.
- - name: Verify signature
- if: env.HAS_SIGNING_KEY == 'true'
- run: |
- apksigner=$(ls -d "$ANDROID_HOME"/build-tools/*/ | sort -V | tail -1)apksigner
- "$apksigner" verify --print-certs "$APK" | grep -E "certificate (DN|SHA-256)"
-
- - uses: actions/upload-artifact@v4
- with:
- name: ${{ inputs.artifact }}-${{ env.VERSION_NAME }}
- path: dist/
- if-no-files-found: error
-
- - name: Publish release
- if: env.RELEASE_TAG != ''
- env:
- GH_TOKEN: ${{ github.token }}
- PREFIX: ${{ inputs.tag_prefix }}
- APP: ${{ inputs.app }}
- run: |
- # Notes cover this app's previous release onwards, not other apps' tags.
- prev=$(git tag -l "$PREFIX*" --sort=-v:refname | grep -vx "$RELEASE_TAG" | head -1 || true)
- gh release create "$RELEASE_TAG" "$APK" "$META" \
- --target "$GITHUB_SHA" \
- --title "$APP $VERSION_NAME" \
- --generate-notes ${prev:+--notes-start-tag "$prev"} \
- --latest=false
-
- # A rolling release that always holds the newest build from main.
- - name: Publish rolling release
- if: env.IS_ROLLING == 'true'
- env:
- GH_TOKEN: ${{ github.token }}
- ROLLING: ${{ inputs.rolling_tag }}
- APP: ${{ inputs.app }}
- run: |
- gh release delete "$ROLLING" --cleanup-tag --yes || true
- gh release create "$ROLLING" "$APK" "$META" \
- --target "$GITHUB_SHA" \
- --title "$APP latest build ($VERSION_NAME)" \
- --notes "Built from ${GITHUB_SHA::7} on main. Installs over any earlier build." \
- --latest=false
diff --git a/.github/workflows/apps.yml b/.github/workflows/apps.yml
new file mode 100644
index 0000000..de9a171
--- /dev/null
+++ b/.github/workflows/apps.yml
@@ -0,0 +1,167 @@
+# The one workflow for every app. Each push to main builds all four, signed
+# with their own keys and sharing one version (appVersion in gradle.properties,
+# plus the build number), and replaces the single rolling `latest` release with
+# them. Pull requests only build and test. See docs/releasing.md.
+name: Apps
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ workflow_dispatch:
+
+# Builds from main replace the same release, so let them finish in order.
+concurrency:
+ group: apps-${{ github.ref }}
+ cancel-in-progress: false
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ env:
+ PUBLISH: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
+ KEYS: ${{ github.workspace }}/../keys
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: actions/setup-java@v4
+ with:
+ distribution: temurin
+ java-version: 17
+
+ - uses: gradle/actions/setup-gradle@v4
+
+ # Every app gets the same version: appVersion.<build number>. Version
+ # codes start at 1000, above anything released before the apps shared one.
+ - name: Version
+ run: |
+ base=$(grep '^appVersion=' gradle.properties | cut -d= -f2 | tr -d '[:space:]')
+ echo "VERSION_NAME=$base.$GITHUB_RUN_NUMBER" >> "$GITHUB_ENV"
+ echo "VERSION_CODE=$((1000 + GITHUB_RUN_NUMBER))" >> "$GITHUB_ENV"
+ echo "Version $base.$GITHUB_RUN_NUMBER ($((1000 + GITHUB_RUN_NUMBER)))"
+
+ - name: Restore signing keys
+ env:
+ PLURAL_KEYSTORE_BASE64: ${{ secrets.PLURAL_KEYSTORE_BASE64 }}
+ INBOX_KEYSTORE_BASE64: ${{ secrets.INBOX_KEYSTORE_BASE64 }}
+ INBOX_PASSWORD: ${{ secrets.INBOX_KEYSTORE_PASSWORD }}
+ DEVICE_REPORTER_KEYSTORE_BASE64: ${{ secrets.DEVICE_REPORTER_KEYSTORE_BASE64 }}
+ MANAGER_KEYSTORE_BASE64: ${{ secrets.MANAGER_KEYSTORE_BASE64 }}
+ INBOX_GOOGLE_SERVICES_JSON: ${{ secrets.INBOX_GOOGLE_SERVICES_JSON }}
+ run: |
+ mkdir -p "$KEYS"
+ missing=""
+ restore() {
+ if [ -n "$2" ]; then echo "$2" | base64 -d > "$KEYS/$1.p12"; else missing="$missing $1"; fi
+ }
+ restore plural "$PLURAL_KEYSTORE_BASE64"
+ restore inbox "$INBOX_KEYSTORE_BASE64"
+ restore device-reporter "$DEVICE_REPORTER_KEYSTORE_BASE64"
+ restore manager "$MANAGER_KEYSTORE_BASE64"
+ # Inbox reads its key through email/keystore.properties.
+ if [ -f "$KEYS/inbox.p12" ]; then
+ umask 077
+ printf 'storeFile=%s\nstorePassword=%s\nkeyAlias=inbox\nkeyPassword=%s\n' \
+ "$KEYS/inbox.p12" "$INBOX_PASSWORD" "$INBOX_PASSWORD" > email/keystore.properties
+ fi
+ if [ -n "$INBOX_GOOGLE_SERVICES_JSON" ]; then
+ echo "$INBOX_GOOGLE_SERVICES_JSON" | base64 -d > email/app/google-services.json
+ fi
+ # A published APK must carry its app's own key, or it won't install
+ # over earlier builds; say so rather than ship the debug key.
+ if [ "$PUBLISH" = true ] && [ -n "$missing" ]; then
+ echo "::error::Signing secrets are missing for:$missing. See docs/releasing.md."
+ exit 1
+ fi
+
+ - name: Build
+ env:
+ PLURAL_PASSWORD: ${{ secrets.PLURAL_STORE_PASSWORD }}
+ INBOX_PASSWORD: ${{ secrets.INBOX_KEYSTORE_PASSWORD }}
+ DEVICE_REPORTER_PASSWORD: ${{ secrets.DEVICE_REPORTER_STORE_PASSWORD }}
+ DEVICE_REPORTER_ALIAS: ${{ secrets.DEVICE_REPORTER_KEY_ALIAS }}
+ MANAGER_PASSWORD: ${{ secrets.MANAGER_STORE_PASSWORD }}
+ run: bash .github/scripts/build-apps.sh dist
+
+ # Fails on a badly signed APK, and prints each certificate so it can be
+ # checked against docs/releasing.md.
+ - name: Verify signatures
+ if: env.PUBLISH == 'true'
+ run: |
+ apksigner=$(ls -d "$ANDROID_HOME"/build-tools/*/ | sort -V | tail -1)apksigner
+ for apk in dist/*.apk; do
+ echo "$apk"
+ "$apksigner" verify --print-certs "$apk" | grep "certificate SHA-256"
+ done
+
+ - uses: actions/upload-artifact@v4
+ with:
+ name: apps
+ path: dist/
+ if-no-files-found: error
+
+ # One release, `latest`, always holding every app's newest build.
+ - name: Publish the rolling release
+ if: env.PUBLISH == 'true'
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ base="https://github.com/$GITHUB_REPOSITORY/releases/latest/download"
+ {
+ echo "Every app, built from ${GITHUB_SHA::7} on main. All four are version **$VERSION_NAME**."
+ echo
+ echo "| App | Install |"
+ echo "|---|---|"
+ echo "| System | [system.apk]($base/system.apk) |"
+ echo "| Inbox | [inbox.apk]($base/inbox.apk) |"
+ echo "| Device Reporter | [device-reporter.apk]($base/device-reporter.apk) |"
+ echo "| Doughmination Manager | [doughmination-manager.apk]($base/doughmination-manager.apk) |"
+ echo
+ echo "These links always point at the newest build. Each installs over any earlier build of that app."
+ } > notes.md
+ gh release delete latest --cleanup-tag --yes || true
+ gh release create latest dist/*.apk dist/versions.json \
+ --target "$GITHUB_SHA" \
+ --title "Doughmination apps $VERSION_NAME" \
+ --notes-file notes.md \
+ --latest
+
+ # Installs the System app on an emulator, walks its screens and screenshots
+ # each one; fails if it won't install, launch, or show what it should.
+ smoke:
+ needs: build
+ runs-on: ubuntu-latest
+ timeout-minutes: 40
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: actions/download-artifact@v4
+ with:
+ name: apps
+ path: dist
+
+ - name: Enable KVM
+ run: |
+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
+ sudo udevadm control --reload-rules
+ sudo udevadm trigger --name-match=kvm
+
+ - name: Run on an emulator
+ uses: reactivecircus/android-emulator-runner@v2
+ with:
+ api-level: 34
+ target: default
+ arch: x86_64
+ profile: pixel_6
+ disable-animations: true
+ emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
+ script: bash .github/scripts/plural-smoke.sh dist/system.apk smoke
+
+ - uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: smoke-screenshots
+ path: smoke/
+ if-no-files-found: warn
diff --git a/.github/workflows/device-reporter.yml b/.github/workflows/device-reporter.yml
deleted file mode 100644
index 3c99fa8..0000000
--- a/.github/workflows/device-reporter.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-name: Device Reporter
-
-on:
- push:
- branches: [main]
- tags: ["device-reporter-v*"]
- paths: &paths
- - "api-helper/**"
- - "gradle/**"
- - "*.gradle.kts"
- - "gradle.properties"
- - "gradlew*"
- - ".github/workflows/device-reporter.yml"
- - ".github/workflows/android-app.yml"
- pull_request:
- paths: *paths
- workflow_dispatch:
- inputs:
- version:
- description: "Release version, e.g. v2.1.0 (creates device-reporter-v2.1.0). Leave blank to just build."
- required: false
- type: string
-
-concurrency:
- group: device-reporter-${{ github.ref }}
- cancel-in-progress: false
-
-jobs:
- device-reporter:
- permissions:
- contents: write
- uses: ./.github/workflows/android-app.yml
- with:
- app: Device Reporter
- module: ":api-helper:app"
- module_dir: api-helper/app
- package_name: uk.doughmination.devicereporter
- artifact: device-reporter
- tag_prefix: device-reporter-v
- # v2.0.0 shipped as versionCode 2 from doughmination/api-helper; stay above it.
- version_code_base: 100
- dev_version_prefix: "2.0"
- signing: env
- release_version: ${{ inputs.version }}
- secrets:
- keystore_base64: ${{ secrets.DEVICE_REPORTER_KEYSTORE_BASE64 }}
- store_password: ${{ secrets.DEVICE_REPORTER_STORE_PASSWORD }}
- key_alias: ${{ secrets.DEVICE_REPORTER_KEY_ALIAS }}
- key_password: ${{ secrets.DEVICE_REPORTER_KEY_PASSWORD }}
diff --git a/.github/workflows/inbox.yml b/.github/workflows/inbox.yml
deleted file mode 100644
index 2e08eb9..0000000
--- a/.github/workflows/inbox.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-name: Inbox
-
-on:
- push:
- branches: [main]
- tags: ["inbox-v*"]
- paths: &paths
- - "email/**"
- - "gradle/**"
- - "*.gradle.kts"
- - "gradle.properties"
- - "gradlew*"
- - ".github/workflows/inbox.yml"
- - ".github/workflows/android-app.yml"
- pull_request:
- paths: *paths
- workflow_dispatch:
-
-# Builds from main replace the same rolling release, so let them finish in order.
-concurrency:
- group: inbox-${{ github.ref }}
- cancel-in-progress: false
-
-jobs:
- inbox:
- permissions:
- contents: write
- uses: ./.github/workflows/android-app.yml
- with:
- app: Inbox
- module: ":email:app"
- module_dir: email/app
- package_name: gay.doughmination.mail
- artifact: inbox
- tag_prefix: inbox-v
- # Builds 1-7 shipped from doughmination/email; stay above them.
- version_code_base: 100
- dev_version_prefix: "1.0"
- signing: properties
- properties_dir: email
- key_alias: inbox
- google_services_path: email/app/google-services.json
- # The mail site's /download link redirects to this release's APK.
- rolling_tag: inbox-latest
- secrets:
- keystore_base64: ${{ secrets.INBOX_KEYSTORE_BASE64 }}
- store_password: ${{ secrets.INBOX_KEYSTORE_PASSWORD }}
- google_services_json: ${{ secrets.INBOX_GOOGLE_SERVICES_JSON }}
diff --git a/.github/workflows/manager.yml b/.github/workflows/manager.yml
deleted file mode 100644
index 376890d..0000000
--- a/.github/workflows/manager.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-name: Doughmination Manager
-
-on:
- push:
- branches: [main]
- tags: ["manager-v*"]
- paths: &paths
- - "doughmination-manager/**"
- - "gradle/**"
- - "*.gradle.kts"
- - "gradle.properties"
- - "gradlew*"
- - ".github/workflows/manager.yml"
- - ".github/workflows/android-app.yml"
- pull_request:
- paths: *paths
- workflow_dispatch:
- inputs:
- version:
- description: "Release version, e.g. v0.1.0 (creates manager-v0.1.0). Leave blank to just build."
- required: false
- type: string
-
-concurrency:
- group: manager-${{ github.ref }}
- cancel-in-progress: false
-
-jobs:
- manager:
- permissions:
- contents: write
- uses: ./.github/workflows/android-app.yml
- with:
- app: Doughmination Manager
- module: ":doughmination-manager:app"
- module_dir: doughmination-manager/app
- package_name: gay.doughmination.manager
- artifact: manager
- tag_prefix: manager-v
- version_code_base: 100
- dev_version_prefix: "0.1"
- signing: env
- release_version: ${{ inputs.version }}
- secrets:
- keystore_base64: ${{ secrets.MANAGER_KEYSTORE_BASE64 }}
- store_password: ${{ secrets.MANAGER_STORE_PASSWORD }}
- key_alias: ${{ secrets.MANAGER_KEY_ALIAS }}
- key_password: ${{ secrets.MANAGER_KEY_PASSWORD }}
diff --git a/.github/workflows/plural-smoke.yml b/.github/workflows/plural-smoke.yml
deleted file mode 100644
index fee70d7..0000000
--- a/.github/workflows/plural-smoke.yml
+++ /dev/null
@@ -1,70 +0,0 @@
-# Builds Plural's signed release APK and runs it on an Android emulator:
-# install, launch, walk the tabs, screenshot each step, fail on a crash.
-# Screenshots and the APK are uploaded with the run.
-name: Plural smoke test
-
-on:
- workflow_dispatch:
- pull_request:
- paths: ["plural/**", ".github/workflows/plural-smoke.yml", ".github/scripts/plural-smoke.sh"]
-
-jobs:
- emulator:
- runs-on: ubuntu-latest
- timeout-minutes: 40
- env:
- HAS_SIGNING_KEY: ${{ secrets.PLURAL_KEYSTORE_BASE64 != '' }}
- steps:
- - uses: actions/checkout@v4
-
- - uses: actions/setup-java@v4
- with:
- distribution: temurin
- java-version: 17
-
- - uses: gradle/actions/setup-gradle@v4
-
- - name: Restore signing key
- if: env.HAS_SIGNING_KEY == 'true'
- env:
- KEYSTORE_BASE64: ${{ secrets.PLURAL_KEYSTORE_BASE64 }}
- STORE_PASSWORD: ${{ secrets.PLURAL_STORE_PASSWORD }}
- KEY_ALIAS: ${{ secrets.PLURAL_KEY_ALIAS }}
- KEY_PASSWORD: ${{ secrets.PLURAL_KEY_PASSWORD }}
- run: |
- echo "$KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.p12"
- {
- echo "SIGNING_STORE_FILE=$RUNNER_TEMP/release.p12"
- echo "SIGNING_STORE_PASSWORD=$STORE_PASSWORD"
- echo "SIGNING_KEY_ALIAS=$KEY_ALIAS"
- echo "SIGNING_KEY_PASSWORD=$KEY_PASSWORD"
- } >> "$GITHUB_ENV"
-
- - name: Build
- run: ./gradlew :plural:app:assembleRelease --console=plain
-
- - name: Enable KVM
- run: |
- echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
- sudo udevadm control --reload-rules
- sudo udevadm trigger --name-match=kvm
-
- - name: Run on an emulator
- uses: reactivecircus/android-emulator-runner@v2
- with:
- api-level: 34
- target: default
- arch: x86_64
- profile: pixel_6
- disable-animations: true
- emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
- script: bash .github/scripts/plural-smoke.sh plural/app/build/outputs/apk/release/app-release.apk smoke
-
- - uses: actions/upload-artifact@v4
- if: always()
- with:
- name: plural-smoke
- path: |
- smoke/
- plural/app/build/outputs/apk/release/app-release.apk
- if-no-files-found: warn
diff --git a/.github/workflows/plural.yml b/.github/workflows/plural.yml
deleted file mode 100644
index 5bb6998..0000000
--- a/.github/workflows/plural.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-name: Plural
-
-on:
- push:
- branches: [main]
- tags: ["plural-v*"]
- paths: &paths
- - "plural/**"
- - "gradle/**"
- - "*.gradle.kts"
- - "gradle.properties"
- - "gradlew*"
- - ".github/workflows/plural.yml"
- - ".github/workflows/android-app.yml"
- pull_request:
- paths: *paths
- workflow_dispatch:
- inputs:
- version:
- description: "Release version, e.g. v0.1.0 (creates plural-v0.1.0). Leave blank to just build."
- required: false
- type: string
-
-concurrency:
- group: plural-${{ github.ref }}
- cancel-in-progress: false
-
-jobs:
- plural:
- permissions:
- contents: write
- uses: ./.github/workflows/android-app.yml
- with:
- app: Plural
- module: ":plural:app"
- module_dir: plural/app
- package_name: gay.doughmination.plural
- artifact: plural
- tag_prefix: plural-v
- version_code_base: 100
- dev_version_prefix: "0.1"
- signing: env
- release_version: ${{ inputs.version }}
- secrets:
- keystore_base64: ${{ secrets.PLURAL_KEYSTORE_BASE64 }}
- store_password: ${{ secrets.PLURAL_STORE_PASSWORD }}
- key_alias: ${{ secrets.PLURAL_KEY_ALIAS }}
- key_password: ${{ secrets.PLURAL_KEY_PASSWORD }}
diff --git a/README.md b/README.md
index 22f4e3b..96133cd 100644
--- a/README.md
+++ b/README.md
@@ -3,12 +3,12 @@
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` |
-| System (Plural) | [`plural/`](plural/) | `:plural:app` | `gay.doughmination.plural` | `plural.yml` |
+| App | Directory | Gradle module | Application ID |
+|---|---|---|---|
+| Device Reporter | [`api-helper/`](api-helper/) | `:api-helper:app` | `uk.doughmination.devicereporter` |
+| Inbox | [`email/`](email/) | `:email:app` | `gay.doughmination.mail` |
+| Doughmination Manager | [`doughmination-manager/`](doughmination-manager/) | `:doughmination-manager:app` | `gay.doughmination.manager` |
+| System (Plural) | [`plural/`](plural/) | `:plural:app` | `gay.doughmination.plural` |
Doughmination Manager is a placeholder for now: it builds and runs, and
nothing else. Plural is the System app; see [plural/README.md](plural/README.md).
@@ -22,7 +22,7 @@ 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
+.github/workflows/apps.yml one workflow: builds, signs and releases every app
```
The apps share the build and the catalog, never each other's code: no app
@@ -39,4 +39,6 @@ Needs JDK 17–21 (Gradle 8.11 doesn't run on newer ones) and the Android SDK
./gradlew assembleDebug # all of them
```
-Releases are built by CI; see [docs/releasing.md](docs/releasing.md).
+Every push to `main` builds all four apps and replaces the single rolling
+[`latest` release](https://github.com/doughmination/apps/releases/latest) with them,
+all sharing one version. See [docs/releasing.md](docs/releasing.md).
diff --git a/api-helper/README.md b/api-helper/README.md
index 3f92841..72c7e22 100644
--- a/api-helper/README.md
+++ b/api-helper/README.md
@@ -84,20 +84,13 @@ 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. Device Reporter lives in the
-[doughmination/apps](https://github.com/doughmination/apps) monorepo, and its workflow is
-`.github/workflows/device-reporter.yml`.
+[doughmination/apps](https://github.com/doughmination/apps) monorepo, which builds every app with
+one workflow.
-**Every change:** every push to `main` that touches `api-helper/` builds a signed APK and
-publishes it as a release (`device-reporter-v2.0.N`). Download it from the repo's
-**Releases** page.
+**Install:** every push to `main` publishes a signed build. The newest is always at
+https://github.com/doughmination/apps/releases/latest/download/device-reporter.apk.
-**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 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
+Versions and the signing secrets
(`DEVICE_REPORTER_*`) are covered in [docs/releasing.md](../docs/releasing.md).
Keep the keystore safe and out of git — losing it means you can't ship signed updates that
diff --git a/api-helper/app/build.gradle.kts b/api-helper/app/build.gradle.kts
index 107cc0f..df90ca7 100644
--- a/api-helper/app/build.gradle.kts
+++ b/api-helper/app/build.gradle.kts
@@ -11,9 +11,10 @@ android {
applicationId = "uk.doughmination.devicereporter"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
- // CI sets these (see docs/releasing.md); local builds use the fallbacks.
- versionCode = System.getenv("VERSION_CODE")?.toInt() ?: 2
- versionName = System.getenv("VERSION_NAME") ?: "2.0.0"
+ // CI sets these from appVersion in gradle.properties (docs/releasing.md);
+ // local builds use the fallbacks.
+ versionCode = System.getenv("VERSION_CODE")?.toInt() ?: 1
+ versionName = System.getenv("VERSION_NAME") ?: "${project.property("appVersion")}.0"
}
signingConfigs {
diff --git a/docs/releasing.md b/docs/releasing.md
index f08aafc..2ac7886 100644
--- a/docs/releasing.md
+++ b/docs/releasing.md
@@ -1,60 +1,50 @@
# Releasing
-Each app releases on its own, and only when it changed. All of it runs in
-`.github/workflows/android-app.yml`, called by each app's workflow.
+One workflow, `.github/workflows/apps.yml`, builds and releases every app
+together. There is one release, **`latest`**, and it always holds the newest
+build of all four apps.
-## When CI runs
+## What happens on a push
-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 push to `main`** builds all four apps, each signed with its own key,
+ checks the signatures, and replaces the `latest` release with them. Then it
+ installs the System app on an emulator and walks its screens
+ (`.github/scripts/plural-smoke.sh`); screenshots are attached to the run.
+- **Pull requests** build and run the emulator test, and publish nothing.
-- **Every push to `main` that builds an app publishes a release of it**, signed,
- named by its version: `plural-v0.1.107` holds `plural-0.1.107.apk`. A change
- to the shared Gradle files or `android-app.yml` releases every app.
-- Pull requests only build (unsigned or debug-signed) and publish nothing.
-- A tag, or "Run workflow" with a version, publishes a release with a chosen
- version name instead, for when a build deserves a real number.
+The release's files keep the same names, so these links always give the
+newest build:
-| App | Releases from `main` | Chosen version |
-|---|---|---|
-| Device Reporter | `device-reporter-v2.0.N` | `device-reporter-v2.1.0` |
-| Inbox | `inbox-v1.0.N`, and `inbox-latest` always holds the newest | `inbox-v1.2.0` |
-| Doughmination Manager | `manager-v0.1.N` | `manager-v0.1.0` |
-| Plural | `plural-v0.1.N` | `plural-v0.1.0` |
-
-(`N` is the version code.) The mail site's `/download` follows `inbox-latest`.
-
-```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`.
+| App | Link |
+|---|---|
+| System | https://github.com/doughmination/apps/releases/latest/download/system.apk |
+| Inbox | https://github.com/doughmination/apps/releases/latest/download/inbox.apk |
+| Device Reporter | https://github.com/doughmination/apps/releases/latest/download/device-reporter.apk |
+| Doughmination Manager | https://github.com/doughmination/apps/releases/latest/download/doughmination-manager.apk |
-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)).
+Next to them, `versions.json` lists each APK's package name, version, SHA-256
+and size, for the Manager's manifest ([manifest.md](manifest.md)). The mail
+site's `/download` sends people to `inbox.apk`.
-## Version codes
+## Versions
-Android only installs an update whose `versionCode` is higher than the
-installed one, so CI sets it:
+Every app carries the same version:
```
-versionCode = 100 + the workflow's run number
-versionName = the tag's version (1.2.0), or <prefix>.<versionCode> for untagged builds
+versionName = <appVersion>.<build number> e.g. 2.1.14
+versionCode = 1000 + <build number>
```
-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.
+`appVersion` lives in `gradle.properties`; change it there for a new minor or
+major version (`2.2`, `3.0`). The build number is the `apps.yml` run number, so
+it only ever goes up, and so do version codes, which is what lets each build
+install over the last. (1000 is above every code released before the apps
+shared a version; the highest was 107.) **If `apps.yml` is ever renamed or
+recreated, its run numbers restart: raise the 1000 in it above the last
+release's code first.**
+
+Local builds use `<appVersion>.0` and code 1, so they never install over a
+release.
## Signing
@@ -71,8 +61,8 @@ The apps read their key two ways, as they did before the move:
`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.
+Pull requests build unsigned or debug-signed. A push to `main` fails rather
+than publish anything without the real keys.
### The keys
diff --git a/doughmination-manager/app/build.gradle.kts b/doughmination-manager/app/build.gradle.kts
index c2bc941..11fa2d2 100644
--- a/doughmination-manager/app/build.gradle.kts
+++ b/doughmination-manager/app/build.gradle.kts
@@ -14,9 +14,10 @@ android {
applicationId = "gay.doughmination.manager"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
- // CI sets these (see docs/releasing.md); local builds use the fallbacks.
+ // CI sets these from appVersion in gradle.properties (docs/releasing.md);
+ // local builds use the fallbacks.
versionCode = System.getenv("VERSION_CODE")?.toInt() ?: 1
- versionName = System.getenv("VERSION_NAME") ?: "0.1.0"
+ versionName = System.getenv("VERSION_NAME") ?: "${project.property("appVersion")}.0"
}
// Same convention as Device Reporter: CI passes the key through SIGNING_*
diff --git a/email/README.md b/email/README.md
index d6ffb1b..4614e0b 100644
--- a/email/README.md
+++ b/email/README.md
@@ -66,14 +66,13 @@ changing too.
## CI
-`.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
-a release of its own (`inbox-v1.0.112`). Each build from `main` also 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
+Every push to `main` builds Inbox with the other apps (`.github/workflows/apps.yml`)
+and publishes it to the rolling `latest` release as `inbox.apk`, which the mail
+site's `/download` link redirects to:
+https://github.com/doughmination/apps/releases/latest/download/inbox.apk. Secrets
(`INBOX_KEYSTORE_BASE64`, `INBOX_KEYSTORE_PASSWORD`, optionally
-`INBOX_GOOGLE_SERVICES_JSON`) and version codes are in
+`INBOX_GOOGLE_SERVICES_JSON`) and versions are in
[docs/releasing.md](../docs/releasing.md).
-Builds up to 1.0.7 were released from doughmination/email; they're still on
-its releases page, and these install over them.
+Builds up to 1.0.7 were released from doughmination/email, signed with an older
+key: uninstall one of those once before installing a build from here.
diff --git a/email/app/build.gradle.kts b/email/app/build.gradle.kts
index a98c6b6..6206654 100644
--- a/email/app/build.gradle.kts
+++ b/email/app/build.gradle.kts
@@ -32,9 +32,10 @@ android {
applicationId = "gay.doughmination.mail"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
- // CI sets these so every build installs over the last (see docs/releasing.md).
+ // CI sets these from appVersion in gradle.properties (docs/releasing.md);
+ // local builds use the fallbacks.
versionCode = (System.getenv("VERSION_CODE") ?: "1").toInt()
- versionName = System.getenv("VERSION_NAME") ?: "1.0"
+ versionName = System.getenv("VERSION_NAME") ?: "${project.property("appVersion")}.0"
buildConfigField("String", "INBOX_URL", "\"$inboxUrl\"")
}
diff --git a/gradle.properties b/gradle.properties
index 5f4cff3..4fa1c5d 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -2,3 +2,8 @@ org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8
android.useAndroidX=true
android.nonTransitiveRClass=true
kotlin.code.style=official
+
+# The version every app shares: CI builds <appVersion>.<build number>, and all
+# four APKs in a release carry the same version. Bump this for a new minor or
+# major version; see docs/releasing.md.
+appVersion=2.1
diff --git a/plural/README.md b/plural/README.md
index bed035d..d1a80cd 100644
--- a/plural/README.md
+++ b/plural/README.md
@@ -81,7 +81,7 @@ From the repository root:
`-PapiUrl=https://…/v2` points a build at another API.
-CI: `plural.yml` builds, signs and releases it on every push to `main` that
-touches `plural/` (`plural-v0.1.N`), and
-`plural-smoke.yml` installs the signed APK on an emulator, walks the tabs and
-uploads screenshots.
+CI: every push to `main` builds it with the other apps (`.github/workflows/apps.yml`),
+publishes it to the rolling release as `system.apk`
+(https://github.com/doughmination/apps/releases/latest/download/system.apk), then installs
+it on an emulator, walks the tabs and uploads screenshots.
diff --git a/plural/app/build.gradle.kts b/plural/app/build.gradle.kts
index 7544765..e42f6bb 100644
--- a/plural/app/build.gradle.kts
+++ b/plural/app/build.gradle.kts
@@ -13,14 +13,15 @@ android {
compileSdk = libs.versions.compileSdk.get().toInt()
defaultConfig {
- // Not released yet, so this ID can still change. Once an APK ships,
- // it (and the signing key) must stay the same for updates to install.
+ // Released: this ID (and the signing key) must never change, or
+ // updates won't install over what people have.
applicationId = "gay.doughmination.plural"
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
- // CI sets these (see docs/releasing.md); local builds use the fallbacks.
+ // CI sets these from appVersion in gradle.properties (docs/releasing.md);
+ // local builds use the fallbacks.
versionCode = System.getenv("VERSION_CODE")?.toInt() ?: 1
- versionName = System.getenv("VERSION_NAME") ?: "0.1.0"
+ versionName = System.getenv("VERSION_NAME") ?: "${project.property("appVersion")}.0"
buildConfigField("String", "API_URL", "\"$apiUrl\"")
// Member pages on the website, for sharing.
buildConfigField("String", "SITE_URL", "\"https://doughmination.co.uk\"")