commit
Document Firebase setup and restore its config in CI
Co-Authored-By: Claude Opus 5.5 <[email protected]>
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 8550ac7..c3dd9fe 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -48,6 +48,15 @@ jobs:
printf 'storeFile=inbox.jks\nstorePassword=%s\nkeyAlias=inbox\nkeyPassword=%s\n' \
"$KEYSTORE_PASSWORD" "$KEYSTORE_PASSWORD" > keystore.properties
+ # Notifications need the Firebase config. Commit app/app/google-services.json
+ # (it isn't secret) or store it base64'd in this secret; without either the
+ # APK builds with notifications off.
+ - name: Restore Firebase config
+ env:
+ GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
+ if: env.GOOGLE_SERVICES_JSON != ''
+ run: echo "$GOOGLE_SERVICES_JSON" | base64 -d > app/google-services.json
+
- name: Build
env:
VERSION_CODE: ${{ github.run_number }}
diff --git a/app/README.md b/app/README.md
index 67e7557..e6506c2 100644
--- a/app/README.md
+++ b/app/README.md
@@ -26,6 +26,10 @@ app/src/main/java/gay/doughmination/mail/
and its PKCE verifier for a session token, sent as `Authorization: Bearer`.
- **Email HTML** renders in a WebView with JavaScript off. Links open in the
browser, and remote content is blocked until you tap "Load remote images".
+- **Notifications**: when Resend's webhook delivers mail, the Worker sends a
+ Firebase Cloud Messaging data message to each signed-in install, and
+ `Push.kt` shows it; a tap opens the thread. The app registers its FCM token
+ after sign-in and removes it on sign-out.
- **Admin** stays on the web; the drawer links to it.
- Links to `mail.doughmination.gay/inbox/...` open in the app, which needs the
site's `/.well-known/assetlinks.json` to list this app's signing key.
@@ -44,6 +48,10 @@ echo "sdk.dir=/opt/android-sdk" > local.properties
`-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.
+
Signing reads `keystore.properties` (gitignored):
```properties
@@ -66,3 +74,5 @@ release of its own. It signs with two repository secrets:
- `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
diff --git a/email/README.md b/email/README.md
index f7ff5c4..2dc8919 100644
--- a/email/README.md
+++ b/email/README.md
@@ -65,9 +65,15 @@ SSO lets in becomes a user on first sign-in.
npm run db:migrate:remote
npx wrangler secret put RESEND_API_KEY # also RESEND_WEBHOOK_SECRET,
# OIDC_CLIENT_SECRET, VAPID_PRIVATE_KEY
+npx wrangler secret put FCM_SERVICE_ACCOUNT < service-account.json # Android notifications
npm run deploy
```
+`FCM_SERVICE_ACCOUNT` is the Firebase project's service account key (Firebase
+console > Project settings > Service accounts > Generate new private key). New
+mail is pushed to browsers through Web Push and to the Android app through
+FCM; without the key, the app just gets no notifications.
+
Then:
1. In Resend, point a webhook at `https://<host>/webhook/inbound` for