commit
One workflow per app, sharing android-app.yml
Each app builds when its own directory or the shared Gradle setup changes, and releases from its own tag (inbox-v*, device-reporter-v*, manager-v*, plural-v*). versionCode is 100 + run number, above every build shipped from the old repositories. Inbox keeps its rolling release as inbox-latest. Signing secrets are prefixed by app; each app's Gradle build reads its key as before. The Codeberg mirror moves to the root unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
diff --git a/.github/workflows/android-app.yml b/.github/workflows/android-app.yml
new file mode 100644
index 0000000..963d237
--- /dev/null
+++ b/.github/workflows/android-app.yml
@@ -0,0 +1,228 @@
+# 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 }}
+ 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"
+ 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.jks"
+ 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"
+
+ - 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.RELEASE_TAG == ''
+ 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/device-reporter.yml b/.github/workflows/device-reporter.yml
index 9bec592..3c99fa8 100644
--- a/.github/workflows/device-reporter.yml
+++ b/.github/workflows/device-reporter.yml
@@ -1,84 +1,49 @@
-name: Build APK
+name: Device Reporter
on:
push:
- branches: [ "**" ]
- tags: [ "v*" ]
+ 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. v1.0.0. Leave blank to just build a debug APK."
+ description: "Release version, e.g. v2.1.0 (creates device-reporter-v2.1.0). Leave blank to just build."
required: false
type: string
-jobs:
- # Every push/PR/manual run: build an unsigned debug APK, downloadable from the run's artifacts.
- debug:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-java@v4
- with:
- distribution: temurin
- java-version: "17"
- - uses: android-actions/setup-android@v4
- with:
- packages: platform-tools platforms;android-35 build-tools;35.0.0
- log-accepted-android-sdk-licenses: false
- - run: chmod +x ./gradlew
- - run: ./gradlew assembleDebug --stacktrace
- - uses: actions/upload-artifact@v4
- with:
- name: device-reporter-debug-apk
- path: app/build/outputs/apk/debug/app-debug.apk
- if-no-files-found: error
+concurrency:
+ group: device-reporter-${{ github.ref }}
+ cancel-in-progress: false
- # Builds a SIGNED release and publishes it as the latest Release.
- # Triggered by: "Run workflow" with a version filled in, OR pushing a v* tag.
- release:
- if: >
- (github.event_name == 'workflow_dispatch' && inputs.version != '') ||
- startsWith(github.ref, 'refs/tags/v')
- runs-on: ubuntu-latest
+jobs:
+ device-reporter:
permissions:
contents: write
- env:
- # Version from the manual input, falling back to the tag name on a tag push.
- VERSION: ${{ inputs.version || github.ref_name }}
- steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-java@v4
- with:
- distribution: temurin
- java-version: "17"
- - uses: android-actions/setup-android@v4
- with:
- packages: platform-tools platforms;android-35 build-tools;35.0.0
- log-accepted-android-sdk-licenses: false
- - run: chmod +x ./gradlew
-
- - name: Decode signing keystore
- run: echo "${{ secrets.SIGNING_KEYSTORE_BASE64 }}" | base64 -d > "$RUNNER_TEMP/release.keystore"
-
- - name: Build signed release APK
- env:
- SIGNING_STORE_FILE: ${{ runner.temp }}/release.keystore
- SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
- SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
- SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
- run: ./gradlew assembleRelease --stacktrace
-
- - name: Rename APK with version
- run: |
- mkdir -p dist
- cp app/build/outputs/apk/release/app-release.apk "dist/device-reporter-${VERSION}.apk"
-
- - name: Publish GitHub Release (creates the tag, marked latest)
- uses: softprops/action-gh-release@v2
- with:
- files: dist/device-reporter-${{ env.VERSION }}.apk
- name: Device Reporter ${{ env.VERSION }}
- tag_name: ${{ env.VERSION }}
- make_latest: true
- generate_release_notes: true
+ 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
new file mode 100644
index 0000000..2e08eb9
--- /dev/null
+++ b/.github/workflows/inbox.yml
@@ -0,0 +1,48 @@
+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
new file mode 100644
index 0000000..376890d
--- /dev/null
+++ b/.github/workflows/manager.yml
@@ -0,0 +1,48 @@
+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.yml b/.github/workflows/plural.yml
new file mode 100644
index 0000000..5bb6998
--- /dev/null
+++ b/.github/workflows/plural.yml
@@ -0,0 +1,48 @@
+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 }}