diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8bb28f2..e41ea0a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -109,8 +109,8 @@ jobs: || { echo "::error::The google-play environment lacks ANDROID_UPLOAD_KEYSTORE_B64 or ANDROID_UPLOAD_KEYSTORE_PASS"; exit 1; } umask 077 mkdir -p "$RUNNER_TEMP/keys" - printf '%s' "$KEYSTORE_B64" | base64 -d > "$RUNNER_TEMP/keys/helfer-upload.p12" - printf '%s' "$KEYSTORE_PASS" > "$RUNNER_TEMP/keys/helfer-upload.pass" + printf '%s' "$KEYSTORE_B64" | base64 -d > "$RUNNER_TEMP/keys/fwassist-upload.p12" + printf '%s' "$KEYSTORE_PASS" > "$RUNNER_TEMP/keys/fwassist-upload.pass" - name: Publish env: VERSION: ${{ needs.version.outputs.version }} @@ -120,10 +120,10 @@ jobs: "-p:ApplicationVersion=${VERSION_CODE}" "-p:ApplicationDisplayVersion=${VERSION}" "-p:Version=${VERSION}" - "-p:AndroidSigningKeyStore=${RUNNER_TEMP}/keys/helfer-upload.p12" - -p:AndroidSigningKeyAlias=helfer-upload - "-p:AndroidSigningStorePass=file:${RUNNER_TEMP}/keys/helfer-upload.pass" - "-p:AndroidSigningKeyPass=file:${RUNNER_TEMP}/keys/helfer-upload.pass" + "-p:AndroidSigningKeyStore=${RUNNER_TEMP}/keys/fwassist-upload.p12" + -p:AndroidSigningKeyAlias=fwassist-upload + "-p:AndroidSigningStorePass=file:${RUNNER_TEMP}/keys/fwassist-upload.pass" + "-p:AndroidSigningKeyPass=file:${RUNNER_TEMP}/keys/fwassist-upload.pass" -o publish-android - name: Remove the upload keystore if: always() @@ -147,7 +147,7 @@ jobs: env: VERSION: ${{ needs.version.outputs.version }} run: | - # The SDK writes an unsigned de.codeforfire.helfer.aab beside the -Signed one, and + # The SDK writes an unsigned de.codeforfire.fwassist.aab beside the -Signed one, and # `find | head` once picked the unsigned bundle in Lagebuch, which Play refused # (lagebuch v0.9.3-rc.1). Name the signed files exactly. apk=$(find publish-android -name "*-Signed.apk" | head -n1) @@ -293,11 +293,11 @@ jobs: **Installation ohne Play Store.** Aktiviere einmalig *Installation aus unbekannten Quellen* für den Browser oder Dateimanager, mit dem die APK geöffnet wird. - **Update von 0.1.0 oder älter.** Bis 0.1.0 war jede APK mit einem anderen Schlüssel - signiert. Ab dieser Version ist der Schlüssel fest, deshalb die alte App einmalig - deinstallieren und diese APK neu installieren. Das löscht die gespeicherten - Einstellungen und Schaummittel-Eingaben. Danach installieren sich Updates - einfach darüber. + **Update von 0.3.0-alpha.2 oder älter.** Bis dahin war FwAssist ein anderes Paket, + und jede APK war mit einem anderen Schlüssel signiert. Diese APK installiert sich + deshalb neben der alten App. Die alte App einmalig deinstallieren; ihre + Einstellungen und Schaummittel-Eingaben werden nicht übernommen. Danach + installieren sich Updates einfach darüber. EOF # `gh release create` could do this too (zizmor's superfluous-actions); swapping a working # release step is a change of its own, tested on a tag. @@ -347,7 +347,7 @@ jobs: - uses: r0adkll/upload-google-play@e738b9dd8f2476ea806d921b64aacd24f34515a5 # v1.1.5 with: serviceAccountJson: ${{ steps.auth.outputs.credentials_file_path }} - packageName: de.codeforfire.helfer + packageName: de.codeforfire.fwassist releaseFiles: play/*.aab tracks: ${{ steps.track.outputs.track }} status: draft diff --git a/.gitignore b/.gitignore index b4ae566..cc63390 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ StrykerOutput/ *.trx artifacts/ -# Signing material. The Google Play upload key lives in ~/.config/helfer/, never in the +# Signing material. The Google Play upload key lives in ~/.config/fwassist/, never in the # tree — see docs/releasing.md. These patterns are defence in depth, not the mechanism. *.p12 *.jks diff --git a/AGENTS.md b/AGENTS.md index 9fede4d..fbd3795 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -89,13 +89,13 @@ each can have its own launcher icon on the phone's home screen. `Views.Register(ViewRegistry)`. 3. `CompositionRoot.Modules` and `CompositionRoot.RegisterViews`, and the project reference in `FwAssist.Composition.csproj`. -4. An `` named `de.codeforfire.helfer.launcher.` in +4. An `` named `de.codeforfire.fwassist.launcher.` in `src/FwAssist.App.Android/AndroidManifest.xml`, with its icon as `Resources/drawable/ic_helper_.xml`, `ic_helper__foreground.xml` and `drawable-anydpi-v26/ic_helper_.xml` (copy the Stoppuhr's three files). - The `helfer` in that name is the applicationId, `de.codeforfire.helfer`, - and it stays although the app is now FwAssist: changing it would turn - every installed copy into a separate app that never receives an update. + The `fwassist` in that name is the applicationId, `de.codeforfire.fwassist`, + and it is permanent: changing it would turn every installed copy into a + separate app that never receives an update. 5. `tests/FwAssist.Helpers..Tests/` with a `stryker-config.json`, and the project in `MUTATE_PROJECTS` (Makefile) and in both lists in `.github/workflows/mutation.yml`. diff --git a/Makefile b/Makefile index 0b163b2..2f1f01a 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ CONFIG ?= Debug SLN := FwAssist.sln SLNF := FwAssist.Host.slnf ANDROID_PROJ := src/FwAssist.App.Android/FwAssist.App.Android.csproj -APP_ID := de.codeforfire.helfer +APP_ID := de.codeforfire.fwassist FILTER ?= PROJECT ?= VERSION ?= 0.1.0 @@ -27,9 +27,9 @@ ABI ?= # Google Play upload key. Outside the work tree on purpose — signing material is never # committed, and $(DOCKER_HOME) is a build cache that gets wiped. See docs/releasing.md. -KEYSTORE ?= $(HOME)/.config/helfer/helfer-upload.p12 -KEYSTORE_PASS ?= $(HOME)/.config/helfer/helfer-upload.pass -KEY_ALIAS ?= helfer-upload +KEYSTORE ?= $(HOME)/.config/fwassist/fwassist-upload.p12 +KEYSTORE_PASS ?= $(HOME)/.config/fwassist/fwassist-upload.pass +KEY_ALIAS ?= fwassist-upload # Derived from VERSION by scripts/android-version-code.sh, which the release workflow uses too. # Set it only to override that; Google Play burns a versionCode permanently on first upload, so # a number typed by hand is a mistake that cannot be taken back. @@ -44,10 +44,10 @@ AVD ?= Medium_Phone_API_35 TABLET_AVD ?= Tablet_API_35 # The same Dockerfile as Lagebuch's, so IMAGE=lagebuch-android-build reuses an image already built. IMAGE ?= fwassist-android-build -# DOCKER_HOME is the container's /home/build and so holds the debug signing key. It keeps -# the old name, like KEY_ALIAS: the applicationId is still de.codeforfire.helfer, and a new -# path would mean a new debug key that cannot update a debug build already on a device. -DOCKER_HOME ?= $(HOME)/.cache/helfer-android-build +# DOCKER_HOME is the container's /home/build and so holds the debug signing key. Keep the +# path: a new one would mean a new debug key that cannot update a debug build already on a +# device. +DOCKER_HOME ?= $(HOME)/.cache/fwassist-android-build APK := src/FwAssist.App.Android/bin/$(CONFIG)/net10.0-android/$(APP_ID)-Signed.apk # `aab` always builds Release, whatever CONFIG says — a debug bundle is not uploadable. AAB := src/FwAssist.App.Android/bin/Release/net10.0-android/$(APP_ID)-Signed.aab @@ -258,7 +258,7 @@ install: apk ## Install the APK on the attached device/emulator } run-android: emulator install ## Boot the emulator, install and launch the app - $(ADB) shell am start -n $(APP_ID)/de.codeforfire.helfer.MainActivity + $(ADB) shell am start -n $(APP_ID)/de.codeforfire.fwassist.MainActivity logcat: ## Follow logcat for the running app @pid=$$($(ADB) shell pidof -s $(APP_ID) 2>/dev/null | tr -d '\r'); \ diff --git a/README.md b/README.md index 6424041..2d40120 100644 --- a/README.md +++ b/README.md @@ -63,10 +63,11 @@ Die APK für Android 7.0 und neuer liegt bei den Dateimanager *Installation aus unbekannten Quellen* erlaubt werden. Ein Eintrag im Play Store ist in Vorbereitung. -Bis Version 0.1.0 war jede APK mit einem anderen Schlüssel signiert. Wer eine -solche Version installiert hat, deinstalliert sie einmalig vor dem nächsten -Update. Das löscht die gespeicherten Einstellungen und Schaummittel-Eingaben. -Danach installieren sich neue Versionen einfach darüber. +Bis Version 0.3.0-alpha.2 war FwAssist ein anderes Paket, und jede APK war mit +einem anderen Schlüssel signiert. Eine solche Version wird nicht aktualisiert: +Die neue App installiert sich daneben. Die alte App einmalig deinstallieren; +ihre Einstellungen und Schaummittel-Eingaben werden nicht übernommen. Danach +installieren sich neue Versionen einfach darüber. ### Downloads prüfen diff --git a/changelog.d/+app-id-fwassist.changed.md b/changelog.d/+app-id-fwassist.changed.md new file mode 100644 index 0000000..daa3a5f --- /dev/null +++ b/changelog.d/+app-id-fwassist.changed.md @@ -0,0 +1 @@ +The Android package is now `de.codeforfire.fwassist`, so it matches the app's name before the first Play release; an install of 0.3.0-alpha.2 or older is a different app that stays beside the new one and has to be uninstalled once, without its settings carrying over. diff --git a/changelog.d/+play-upload.changed.md b/changelog.d/+play-upload.changed.md index 0042567..689929c 100644 --- a/changelog.d/+play-upload.changed.md +++ b/changelog.d/+play-upload.changed.md @@ -1 +1 @@ -Release APKs are now signed with the fixed Google Play upload key, so each release installs over the previous one; an install of 0.1.0 or older has to be removed once. +Release APKs are now signed with the fixed Google Play upload key, so each release installs over the previous one. diff --git a/docs/releasing.md b/docs/releasing.md index 7c57ae7..395a000 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -146,27 +146,28 @@ stays a person's decision, taken in the Console. The credentials are contained: reach a single device until someone rolls it out in the Console. Because the sideload `.apk` is extracted from the same signed bundle, it carries -the upload key's certificate too. Up to v0.1.0 every CI build was signed with a -debug key the runner generated fresh, so each APK had a different certificate -and Android refused to install one over the other. From the first release -signed with the upload key on, a sideloaded install updates in place. The last -debug-signed APK has to be uninstalled once; the release body says so. +the upload key's certificate too. Up to v0.3.0-alpha.2 every CI build was +signed with a debug key the runner generated fresh, so each APK had a different +certificate and Android refused to install one over the other; those builds +were also still the package `de.codeforfire.helfer`. From the first release +signed with the upload key on, a sideloaded install updates in place. An older +install is a different app: the new one installs beside it, and the old one has +to be uninstalled once. The release body says so. ### One-time setup The upload key is generated once, on a laptop, and never committed (`.gitignore` carries `*.p12`, `*.jks`, `*.keystore`, `*.pass` as defence in -depth — the mechanism is that it lives outside the tree). Its path and alias -keep the `helfer` name, like the applicationId: +depth — the mechanism is that it lives outside the tree): ```bash -mkdir -p ~/.config/helfer && chmod 700 ~/.config/helfer +mkdir -p ~/.config/fwassist && chmod 700 ~/.config/fwassist keytool -genkeypair -v \ - -keystore ~/.config/helfer/helfer-upload.p12 -storetype PKCS12 \ - -alias helfer-upload -keyalg RSA -keysize 4096 -validity 10000 \ + -keystore ~/.config/fwassist/fwassist-upload.p12 -storetype PKCS12 \ + -alias fwassist-upload -keyalg RSA -keysize 4096 -validity 10000 \ -dname "CN=CodeForFire, O=CodeForFire, C=DE" -printf '%s' '' > ~/.config/helfer/helfer-upload.pass -chmod 600 ~/.config/helfer/helfer-upload.pass +printf '%s' '' > ~/.config/fwassist/fwassist-upload.pass +chmod 600 ~/.config/fwassist/fwassist-upload.pass ``` `-validity 10000` is about 27 years, past Play's 2033 minimum. Use one password @@ -180,10 +181,10 @@ project with one maintainer — but recovery is a support round-trip, not a convenience. Three things can never be changed after the first upload: the package name -(`de.codeforfire.helfer`), the app signing key, and the account type. **Confirm -the package name is final before that first upload.** It stays `helfer` although -the app is now FwAssist, because it already identifies every sideloaded install -(see `AGENTS.md`, *Helpers*). +(`de.codeforfire.fwassist`), the app signing key, and the account type. The +package name matches the app's name and is final; it replaced +`de.codeforfire.helfer` before anything reached Play, so no Play install carries +the old one. #### Handing the key and Play access to CI @@ -197,10 +198,10 @@ publish the other. only the tag pattern `v*`. 2. **Keystore secrets** in that Environment, not in the repository: ```bash - base64 -w0 ~/.config/helfer/helfer-upload.p12 \ + base64 -w0 ~/.config/fwassist/fwassist-upload.p12 \ | gh secret set ANDROID_UPLOAD_KEYSTORE_B64 --env google-play --repo CodeForFire/FwAssist gh secret set ANDROID_UPLOAD_KEYSTORE_PASS --env google-play --repo CodeForFire/FwAssist \ - < ~/.config/helfer/helfer-upload.pass + < ~/.config/fwassist/fwassist-upload.pass ``` 3. **Workload Identity Federation**, in the project that already has the *Google Play Android Developer API* enabled for Lagebuch: @@ -285,7 +286,7 @@ The keystore path, password file and alias are overridable (`KEYSTORE=`, refuses to run without a keystore and a password file. Then, in the Play Console: pick the track → *Create new release* → upload -`de.codeforfire.helfer-Signed.aab` → German release notes → roll out. Never +`de.codeforfire.fwassist-Signed.aab` → German release notes → roll out. Never upload by hand a version the workflow already uploaded: Play refuses the `versionCode` a second time. diff --git a/src/FwAssist.App.Android/AndroidManifest.xml b/src/FwAssist.App.Android/AndroidManifest.xml index 2b5de7b..ec80e20 100644 --- a/src/FwAssist.App.Android/AndroidManifest.xml +++ b/src/FwAssist.App.Android/AndroidManifest.xml @@ -48,7 +48,7 @@ - - - - - - - - - - Exe - de.codeforfire.helfer + de.codeforfire.fwassist @@ -46,7 +46,7 @@ passwords are read from a file rather than passed literally; see docs/releasing.md. --> true - helfer-upload + fwassist-upload diff --git a/src/FwAssist.App.Android/MainActivity.cs b/src/FwAssist.App.Android/MainActivity.cs index e2347a9..d2477f4 100644 --- a/src/FwAssist.App.Android/MainActivity.cs +++ b/src/FwAssist.App.Android/MainActivity.cs @@ -16,7 +16,7 @@ namespace FwAssist.App.Android; /// The only Activity. Declared in AndroidManifest.xml, not by an [Activity] attribute, so the /// launcher aliases can follow it there; [Register] gives it the Java name the manifest uses. /// -[Register("de/codeforfire/helfer/MainActivity")] +[Register("de/codeforfire/fwassist/MainActivity")] public class MainActivity : AvaloniaMainActivity { // One client for the app's life, as HttpClient is meant to be used: only the Kartenpakete use it. diff --git a/src/FwAssist.App.Android/Services/LauncherAlias.cs b/src/FwAssist.App.Android/Services/LauncherAlias.cs index 02358ae..d600eed 100644 --- a/src/FwAssist.App.Android/Services/LauncherAlias.cs +++ b/src/FwAssist.App.Android/Services/LauncherAlias.cs @@ -3,7 +3,7 @@ namespace FwAssist.App.Android.Services; /// The naming rule for a helper's activity-alias, kept in one place. internal static class LauncherAlias { - public const string Prefix = "de.codeforfire.helfer.launcher."; + public const string Prefix = "de.codeforfire.fwassist.launcher."; public static string For(string helperId) => Prefix + helperId; diff --git a/tests/FwAssist.Acceptance.Tests/HelperRegistrationTests.cs b/tests/FwAssist.Acceptance.Tests/HelperRegistrationTests.cs index a93245b..f20934c 100644 --- a/tests/FwAssist.Acceptance.Tests/HelperRegistrationTests.cs +++ b/tests/FwAssist.Acceptance.Tests/HelperRegistrationTests.cs @@ -11,7 +11,7 @@ namespace FwAssist.Acceptance.Tests; // manifest has no launcher icon; an alias whose helper is gone opens the home screen forever. public class HelperRegistrationTests { - private const string AliasPrefix = "de.codeforfire.helfer.launcher."; + private const string AliasPrefix = "de.codeforfire.fwassist.launcher."; private static readonly XNamespace Android = "http://schemas.android.com/apk/res/android"; private static List Aliases() => @@ -37,7 +37,7 @@ public void Each_alias_targets_the_main_activity_and_is_labelled_with_the_helper foreach (var module in CompositionRoot.Modules) { var alias = Aliases().Single(a => (string?)a.Attribute(Android + "name") == AliasPrefix + module.Id); - Assert.Equal("de.codeforfire.helfer.MainActivity", (string?)alias.Attribute(Android + "targetActivity")); + Assert.Equal("de.codeforfire.fwassist.MainActivity", (string?)alias.Attribute(Android + "targetActivity")); Assert.Equal(module.Title, (string?)alias.Attribute(Android + "label")); Assert.Equal("@drawable/ic_helper_" + module.Id, (string?)alias.Attribute(Android + "icon")); }