A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
ci: require explicit mobile builds and gated promotion
Amruth Pillai85a98054c0ac
diff --git a/.agents/docs/container-publishing.md b/.agents/docs/container-publishing.mdindex 7e56350fa..b661d7fc6 100644--- a/.agents/docs/container-publishing.md+++ b/.agents/docs/container-publishing.md@@ -34,55 +34,32 @@ builds. An older build still publishes its SHA and timestamped nightly aliases,the current main HEAD updates the moving `nightly` alias. Architecture-specific buildoutputs use `sha-<full-commit>-amd64` and `sha-<full-commit>-arm64`.-### Nightly Android APKs and GitHub releases--Every push to `main` also builds signed Android APKs for `arm64-v8a`, `armeabi-v7a`,-and `x86_64`, the three ABIs supported by the pinned Forme native binaries. There is-no daily schedule: "nightly" means each main push, matching the Docker publishing mode.-Manual canaries and stable promotions do not build these APKs or create nightly releases.--The `mobile-apk` matrix uses Expo Prebuild, Gradle, and the existing Fastlane Android-build lane on CI runners with Node 24, pnpm, Ruby, Java 17, Android SDK, and the pinned-Forme NDK. Each build selects one ABI, loads the preview EAS environment, and embeds-the preview update channel through `MOBILE_UPDATE_CHANNEL`. Signing uses the existing-Android upload keystore from Actions secrets, matching the manual native release-workflow. Nightlies use version code 1 without allocating store build numbers. Each-APK's signature, ABI, and embedded Forme library are checked before upload. Workflow-artifacts are retained for 14 days.--After all three APK builds and Docker publishing succeed, `nightly-release` creates-`nightly-<workflow-run-id>` at that push's full SHA. Each push gets its own prerelease,-including builds superseded by a newer main push. Prereleases never replace the latest-stable release or trigger production promotion. Each release contains all three APKs,-`SHA256SUMS`, and `CHANGELOG.md`; release assets outlive workflow artifact retention.-The changelog includes full commit messages from `before..after`, deduplicated merged-main PR titles/descriptions, comparison/build links, and the matching SHA Docker image.-It reads local Git history rather than the push payload's potentially truncated commit-list. A newly created main branch includes only its head commit. Very long changelogs-are attached in full, with a shortened release description linking to the attachment.--Required setup: retain `EXPO_TOKEN` and the four `ANDROID_KEYSTORE_*`/`ANDROID_KEY_*`-Actions secrets described in [mobile CI](./mobile-ci.md). The release job uses-`GITHUB_TOKEN` with `contents: write` and `pull-requests: read`;-repository rules must allow the `nightly-*` tags. No signing keys are stored in GitHub-artifacts or releases. Missing credentials fail APK publishing without undoing Docker-publishing. A failed upload leaves a draft release; rerunning the same workflow replaces-only that draft's assets and publishes it once complete. Already published releases are-left unchanged on reruns, supporting immutable releases.--These APKs use package `me.rxresu` and the preview update channel. The Android upload-certificate can differ from Play App Signing, preventing upgrades between Play and-GitHub installations. Back up local drafts before switching distributions. Add the-upload signing certificate's SHA-256 fingerprint to `MOBILE_ANDROID_CERT_SHA256` on-the backend when enabling verified App Links for sideloaded builds; retain the Play-fingerprint. Keep the same upload key across nightly builds so sideloaded installs remain-upgradable. See [mobile release handoff](./mobile-release-handoff.md#nightly-android-downloads).--References: [Expo local production builds](https://docs.expo.dev/guides/local-app-production/) and-[GitHub release API](https://docs.github.com/en/rest/releases/releases#create-a-release).+### Explicit product releases and manual APKs++A push to `main` publishes container images and compatible preview OTA updates only.+It never builds Android APKs, creates Git tags, or creates GitHub Releases. Product+GitHub Releases and `v*` tags are created only by an explicit versioned release operation.+Docker promotion consumes an existing tag or commit; it does not create either.++For a sideloadable APK, dispatch **Mobile Release** on `main` with `platform=android`,+`format=apk`, the desired `abi`, and `upload=false`. Signing requires approval through+`mobile-signing`. The preview APK is a downloadable Actions artifact for 14 days;+release evidence is retained for 90 days. No GitHub tag or release is created.+See [manual Android downloads](./mobile-release-handoff.md#manual-android-downloads).++Forme's manually published, checksum-pinned binary assets remain available at their+existing URLs. Moving those rare artifacts to dedicated storage is deferred; never+remove an asset still referenced by `packages/forme-native/scripts/prebuilt.json`.### Stable promotions+Before moving any container aliases or deploying production, the latest `e2e.yml`+CI run from a `main` push must have completed successfully for the exact full commit+SHA being promoted. Missing, failed, cancelled, or pending CI blocks promotion;+PR checks and manual smoke-only runs cannot authorize it. If historical CI was+removed, that commit is no longer eligible for this promotion path. This check runs+before registry mutations and does not rebuild the source image.+Release tags must be `vMAJOR.MINOR.PATCH`, optionally with a prerelease suffix, and match`package.json` at the tagged commit. Promotion resolves that commit's GHCR`sha-<full-commit>` image, validates both architectures, and copies the complete image indexdiff --git a/.agents/docs/mobile-ci.md b/.agents/docs/mobile-ci.mdindex 56feec3ed..eb115cba3 100644--- a/.agents/docs/mobile-ci.md+++ b/.agents/docs/mobile-ci.md@@ -64,7 +64,7 @@ The workflow allocates both platforms' versions as:MOBILE_BUILD_NUMBER_BASE + (GITHUB_RUN_NUMBER - 1)```-Each new workflow run increments by one. Retries reuse the same build number;+Each new workflow run, including a manual APK request, increments by one. Retries reuse the same build number;if an upload already used that number, dispatch a fresh run instead of rebuildingand uploading it again. The October 21 migration from the old 100-number strideuses base **298**: run 3 already allocated 300, so run 4 allocates 301, then run 5@@ -75,10 +75,12 @@ produce an older version; dispatch a fresh run instead. Stop EAS store builds afsystems do not allocate competing versions. `eas.json` remains legacy configuration;its remote counters and auto-increment do not govern this workflow.-Create GitHub environment **`mobile-store`**, restrict deployment branches to `main`,-and configure required reviewers if you want an approval before uploads. Merely naming-an environment does not enable required reviewers. Both workflow signing and upload-paths are manual, and signing is limited to `main`.+Create separate GitHub environments **`mobile-signing`** and **`mobile-store`**.+Restrict both to branch `main`, require approval from `amruthpillai`, allow self-review,+and disallow admin bypass. The signing environment gates every job that reads signing+credentials; the store environment separately gates jobs that read upload credentials.+The preparation job validates inputs and allocates versions without any secrets.+Merely naming an environment does not configure these protection rules.## Build and upload@@ -86,17 +88,20 @@ paths are manual, and signing is limited to `main`.`apps/mobile/app.config.ts` when needed; iOS requires a new version string after aversion has been released. CI supplies the build number automatically.2. Dispatch **Mobile Release** on `main`, choose `all`, `android`, or `ios`, and leave- **upload** disabled for the first signing check. The workflow validates credentials,+ **format=store** and **upload** disabled for the first signing check. Approve the+ `mobile-signing` gate. The workflow validates signing credentials after approval,runs mobile source checks, fetches checksum-pinned Forme binaries, loads the EAS`production` environment, and generates fresh native projects.3. Inspect the signed artifacts, embedded production update channel, signing identities,- versions, entitlements and native runtime. Artifacts include `release.json`,- `fingerprint.json`, available source maps, and iOS symbols. Raw build logs are not- uploaded because toolchains can include environment values in them. Download the- fingerprint and keep it with the store release record before the 14-day Actions- retention expires. Store binaries stay in workflow artifacts. Separately, each main- push builds Android APKs for public sideloading through the same Fastlane build- lane; see [nightly downloads](./mobile-release-handoff.md#nightly-android-downloads).+ versions, entitlements and native runtime. Store binaries are retained for 90 days.+ A separate `-evidence` artifact retains `release.json`, `fingerprint.json`, available+ JavaScript source maps, iOS dSYMs, Android obfuscation mappings and native debug+ symbols for 90 days. Mapping/symbol files are included when produced by the+ toolchain; this workflow does not enable obfuscation or manufacture missing symbols.+ Raw build logs are not uploaded because toolchains can include environment values.+ Actions retention is capped at 90 days for this public repository and deleting a run+ still deletes its artifacts: export evidence to your permanent release records+ before expiry. This is longer retention, not permanent off-site storage.4. Dispatch with **upload** enabled when ready. Upload jobs start only after everyselected platform built successfully, then pass the `mobile-store` environment gate.They publish the exact signed artifacts from that run. Android creates a **completed@@ -116,10 +121,21 @@ certificate into a temporary keychain, and removes the profile, keychain and temfiles after the build. It never invokes capability synchronization or provisions newApple resources. Renew certificates/profiles before expiry and update Actions secrets.+## Manual Android APKs++Dispatch **Mobile Release** on `main` with `platform=android`, `format=apk`,+`abi=arm64-v8a` (or `armeabi-v7a` / `x86_64`), and `upload=false`. One requested+architecture is built per dispatch. Approve `mobile-signing`, then download the+`mobile-android-<build-number>` Actions artifact within 14 days. The build uses the+preview EAS environment and preview update channel, verifies its APK signature,+checks that it contains only the requested native ABI and includes Forme, and never+uploads to either store or creates a GitHub Release/tag. APK uploads and iOS/all+platform selections are rejected before credentials are accessed.+## OTA compatibility and observabilityThe update URL, EAS project and fingerprint policy remain unchanged. The production-channel is explicitly embedded through `updates.requestHeaders`; nightly APK builds+channel is explicitly embedded through `updates.requestHeaders`; manual APK buildsselect `preview` with `MOBILE_UPDATE_CHANNEL`. Setting a channel in`eas.json` alone does not configure a build produced outside EAS Build. Build numbersare excluded from Expo's normalized config fingerprint. Native project output anddiff --git a/.agents/docs/mobile-release-handoff.md b/.agents/docs/mobile-release-handoff.mdindex 87e89bef1..f47406b78 100644--- a/.agents/docs/mobile-release-handoff.md+++ b/.agents/docs/mobile-release-handoff.md@@ -157,28 +157,27 @@ binaries and deploy the backend first.1. Deploy the backend first. Keep the API backward compatible: older binaries and OTA bundles remain in use.2. Optionally bump `version` in `apps/mobile/app.config.ts` (for example `1.0.0` to `1.1.0`). CI supplies increasing iOS build numbers and Android version codes. iOS needs a new version string after a version is released; Play needs only a higher `versionCode`.3. Dispatch **Mobile Release** on `main`, platform `all`. The [Blacksmith setup guide](./mobile-ci.md) covers migrating existing signing credentials, seeding `MOBILE_BUILD_NUMBER_BASE`, and configuring the `mobile-store` approval environment. Build without uploads first to verify signing. No EAS Build credits are used.-4. Dispatch with **upload** enabled to publish the signed artifacts to every existing Play testing track and all existing TestFlight groups, including external beta groups. iOS waits for processing and submits for TestFlight beta review where required; configure at least one TestFlight group first. This does not submit public App Store review or publish a production release. Fastlane signs locally using existing credentials and does not synchronize Apple capabilities. If exporting credentials through `eas credentials`, keep `EXPO_NO_CAPABILITY_SYNC=1`; Apple sign-in uses web Services ID `me.rxresu.web`, so turning off its primary App ID's Sign in with Apple capability would break sign-in.+4. Dispatch with **format=store** and **upload** enabled to publish the signed artifacts to every existing Play testing track and all existing TestFlight groups, including external beta groups. iOS waits for processing and submits for TestFlight beta review where required; configure at least one TestFlight group first. This does not submit public App Store review or publish a production release. Fastlane signs locally using existing credentials and does not synchronize Apple capabilities. If exporting credentials through `eas credentials`, keep `EXPO_NO_CAPABILITY_SYNC=1`; Apple sign-in uses web Services ID `me.rxresu.web`, so turning off its primary App ID's Sign in with Apple capability would break sign-in.5. **App Store Connect:** wait for processing, test through TestFlight, create the new app version, attach the build, write "What's New", and submit for review. Release manually or automatically after approval.6. **Play Console:** the build is published on `internal` and promoted to every other existing non-production testing track. After testing, promote it to production with release notes. Use a staged rollout for risky changes.7. Run the [signed-device test matrix](#signed-device-test-matrix) on the store-installed builds before promoting to production.8. Confirm that a later OTA update reaches the new binary, because its fingerprint and runtime version changed.-Stable distribution uses the App Store and Play Store. IPA and AAB files are not attached to GitHub Releases. Nightly Android APKs are published separately for sideloading as described below; they do not replace store builds or store review.+Stable distribution uses the App Store and Play Store. IPA and AAB files are not attached to GitHub Releases. Manual Android APKs are available through Actions artifacts as described below; they do not replace store builds or store review.-### Nightly Android downloads+### Manual Android downloads-Every push to `main` builds signed APKs for `arm64-v8a`, `armeabi-v7a`, and `x86_64`-with Expo Prebuild, Gradle, and the existing Fastlane Android build lane. Builds use-the Android upload keystore already stored in Actions secrets; `EXPO_TOKEN` loads-the preview environment. `MOBILE_UPDATE_CHANNEL=preview` embeds the preview update-channel. Nightlies use version code 1 without allocating store build numbers.+Dispatch **Mobile Release** on `main` with `platform=android`, `format=apk`, the desired+`abi` (`arm64-v8a` by default), and `upload=false`. Approve the `mobile-signing` gate.+The selected ABI is built with Expo Prebuild, Gradle and the existing Fastlane lane,+using the existing Android upload keystore and preview EAS environment/channel.+The normal increasing workflow build number is used; retries reuse that number.-Once all APKs and the matching Docker image succeed, CI publishes a GitHub prerelease-named `nightly-<workflow-run-id>` at that exact main commit. It contains the three-APKs, SHA-256 checksums, and a changelog of that push's full commit messages and merged-PR descriptions. Each push is preserved even when builds finish out of order. Stable-release aliases and production OTA publishing follow their existing promotion flow.+Download the signed APK from the run's `mobile-android-<build-number>` Actions+artifact within 14 days. A separate evidence artifact retains the source SHA,+fingerprint and available debugging files for 90 days. Neither a Git tag nor a+GitHub Release is created, and pushes to `main` no longer build APKs.The APKs retain package `me.rxresu`. Their upload signing certificate may differ fromPlay App Signing, so they cannot necessarily upgrade a Play installation or be@@ -188,8 +187,9 @@ add its certificate fingerprint to the backend's `MOBILE_ANDROID_CERT_SHA256` lialongside the Play fingerprint; do not replace the Play fingerprint. Test nativesign-in on an actual sideloaded build before advertising it as verified.-See [container publishing](./container-publishing.md#nightly-android-apks-and-github-releases)-for artifact retention, draft recovery, runner tools, and release permissions.+See [mobile CI](./mobile-ci.md#manual-android-apks) for signing approvals and retention.+Export production release evidence to permanent records before Actions retention+expires; the maximum 90-day retention is not permanent archival storage.## Native artifacts and signingdiff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.ymlindex 903a432ac..591fcb37e 100644--- a/.github/workflows/docker-build.yml+++ b/.github/workflows/docker-build.yml@@ -174,169 +174,6 @@ jobs:if-no-files-found: errorretention-days: 1- mobile-apk:- needs: mode- if: ${{ needs.mode.outputs.nightly == 'true' }}- strategy:- fail-fast: false- matrix:- abi: [arm64-v8a, armeabi-v7a, x86_64]- runs-on: ${{ vars.USE_BLACKSMITH == 'true' && 'blacksmith-32vcpu-ubuntu-2404' || 'ubuntu-latest' }}- timeout-minutes: 60- permissions:- contents: read- env:- CI: "1"- EXPO_NO_TELEMETRY: "1"- FASTLANE_SKIP_UPDATE_CHECK: "1"- FASTLANE_HIDE_CHANGELOG: "1"- FASTLANE_OPT_OUT_USAGE: "1"- BUNDLE_GEMFILE: ${{ github.workspace }}/tooling/mobile/Gemfile- MOBILE_UPDATE_CHANNEL: preview- MOBILE_BUILD_NUMBER: "1"-- steps:- - name: Check Android signing credentials- env:- EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}- ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}- ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}- ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}- ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}- run: |- for name in EXPO_TOKEN ANDROID_KEYSTORE_BASE64 ANDROID_KEYSTORE_PASSWORD ANDROID_KEY_ALIAS ANDROID_KEY_PASSWORD; do- if [[ -z "${!name}" ]]; then- echo "::error::Missing Actions secret: $name"- exit 1- fi- done-- - name: Checkout Repository- if: ${{ vars.USE_BLACKSMITH != 'true' }}- uses: actions/checkout@v7- with: &checkout-mobile-apk- ref: ${{ github.sha }}- persist-credentials: false-- - name: Checkout Repository (Blacksmith)- if: ${{ vars.USE_BLACKSMITH == 'true' }}- uses: useblacksmith/checkout@v1- with: *checkout-mobile-apk-- - name: Install pnpm- uses: pnpm/action-setup@v6-- - name: Setup Node- uses: actions/setup-node@v7- with:- node-version-file: .nvmrc- cache: pnpm-- - name: Setup Java- uses: actions/setup-java@v5- with:- distribution: temurin- java-version: "17"-- - name: Setup Ruby and Fastlane- uses: ruby/setup-ruby@v1- with:- ruby-version: "3.3"- bundler-cache: true- working-directory: tooling/mobile-- - name: Check Android build and signing behavior- run: ruby tooling/mobile/build_test.rb-- - name: Setup Android SDK and Forme NDK- uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4- with:- packages: platform-tools platforms;android-37.0 build-tools;37.0.0 ndk;27.1.12297006 ndk;28.2.13676358 cmake;3.22.1-- - name: Install Dependencies- run: pnpm install --frozen-lockfile-- - name: Setup EAS- uses: expo/expo-github-action@v9- with:- eas-version: 25.2.0- token: ${{ secrets.EXPO_TOKEN }}-- - name: Build signed architecture APK- working-directory: apps/mobile- env:- ABI: ${{ matrix.abi }}- ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}- ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}- ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}- ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}- run: |- node ../../packages/forme-native/scripts/fetch-prebuilt.mjs --platform android- eas env:exec preview --non-interactive \- 'pnpm exec expo prebuild --platform android --clean --no-install && cd ../../tooling/mobile && bundle exec fastlane android build abi:"$ABI"'-- - name: Verify APK signature and architecture- env:- ABI: ${{ matrix.abi }}- run: |- set -euo pipefail- apk="$RUNNER_TEMP/mobile-release/reactive-resume-$ABI.apk"- "$ANDROID_HOME/build-tools/37.0.0/apksigner" verify --verbose --print-certs "$apk"- abis=$(unzip -Z1 "$apk" | awk -F/ '/^lib\/[^/]+\/.*\.so$/ {print $2}' | sort -u)- [[ "$abis" == "$ABI" ]]- unzip -Z1 "$apk" > "$RUNNER_TEMP/apk-entries.txt"- grep -Fx "lib/$ABI/libforme_native.so" "$RUNNER_TEMP/apk-entries.txt"-- - name: Upload APK- uses: actions/upload-artifact@v7- with:- name: nightly-apk-${{ matrix.abi }}- path: ${{ runner.temp }}/mobile-release/*.apk- if-no-files-found: error- retention-days: 14-- nightly-release:- needs: [mode, merge, mobile-apk]- if: ${{ needs.mode.outputs.nightly == 'true' }}- runs-on: ${{ vars.USE_BLACKSMITH == 'true' && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}- timeout-minutes: 10- permissions:- contents: write- pull-requests: read-- steps:- - name: Checkout Repository- if: ${{ vars.USE_BLACKSMITH != 'true' }}- uses: actions/checkout@v7- with: &checkout-nightly-release- ref: ${{ github.sha }}- fetch-depth: 0- persist-credentials: false-- - name: Checkout Repository (Blacksmith)- if: ${{ vars.USE_BLACKSMITH == 'true' }}- uses: useblacksmith/checkout@v1- with: *checkout-nightly-release-- - name: Setup Node- uses: actions/setup-node@v7- with:- node-version-file: .nvmrc-- - name: Download architecture APKs- uses: actions/download-artifact@v8- with:- pattern: nightly-apk-*- path: ${{ runner.temp }}/apks- merge-multiple: true-- - name: Publish nightly release with changelog- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9- with:- script: |- const { publishNightly } = await import(`${process.env.GITHUB_WORKSPACE}/tooling/releases/nightly.mjs`);- await publishNightly({ github, context, artifactDir: `${process.env.RUNNER_TEMP}/apks` });-merge:# Release runs skip build; failed builds must never publish partial indexes.if: ${{ !cancelled() && needs.mode.result == 'success' && (needs.build.result == 'success' || needs.build.result == 'skipped') }}@@ -355,6 +192,7 @@ jobs:PURGE_CLOUDFLARE: ${{ secrets.CLOUDFLARE_ZONE_ID != '' && secrets.CLOUDFLARE_API_TOKEN != '' }}permissions:+ actions: readcontents: readpackages: writeid-token: write@@ -404,6 +242,16 @@ jobs:echo "tagged=$tagged"} >> "$GITHUB_OUTPUT"+ - name: Require successful CI for the exact promotion commit+ if: ${{ needs.mode.outputs.release == 'true' }}+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9+ env:+ COMMIT_SHA: ${{ steps.version.outputs.sha }}+ with:+ script: |+ const { requireSuccessfulCI } = await import(`${process.env.GITHUB_WORKSPACE}/tooling/docker/check-ci.mjs`);+ await requireSuccessfulCI({ github, repo: context.repo, sha: process.env.COMMIT_SHA });+- name: Download digestsif: ${{ needs.mode.outputs.release != 'true' }}uses: actions/download-artifact@v8diff --git a/.github/workflows/mobile-release.yml b/.github/workflows/mobile-release.ymlindex a8c2f4ec8..2f5d8bc00 100644--- a/.github/workflows/mobile-release.yml+++ b/.github/workflows/mobile-release.yml@@ -8,6 +8,16 @@ on:type: choiceoptions: [all, android, ios]default: all+ format:+ description: Store binaries (AAB/IPA), or a downloadable Android APK+ type: choice+ options: [store, apk]+ default: store+ abi:+ description: Android architecture for APK builds (ignored for store binaries)+ type: choice+ options: [arm64-v8a, armeabi-v7a, x86_64]+ default: arm64-v8aupload:description: Publish to all Play testing tracks and TestFlight groups (no production release)type: boolean@@ -21,6 +31,9 @@ concurrency:cancel-in-progress: falseenv:+ FORMAT: ${{ inputs.format }}+ ABI: ${{ inputs.abi }}+ MOBILE_UPDATE_CHANNEL: ${{ inputs.format == 'apk' && 'preview' || 'production' }}CI: "1"EXPO_NO_TELEMETRY: "1"FASTLANE_SKIP_UPDATE_CHECK: "1"@@ -34,7 +47,7 @@ jobs:timeout-minutes: 5outputs:build_number: ${{ steps.release.outputs.build_number }}- platforms: ${{ steps.platforms.outputs.platforms }}+ platforms: ${{ steps.release.outputs.platforms }}steps:- uses: useblacksmith/checkout@v1with:@@ -42,39 +55,17 @@ jobs:- uses: actions/setup-node@v7with:node-version-file: .nvmrc- - name: Validate signing setup and allocate version+ - name: Validate request and allocate version without credentialsid: releaseenv:PLATFORM: ${{ inputs.platform }}UPLOAD: ${{ inputs.upload }}MOBILE_BUILD_NUMBER_BASE: ${{ vars.MOBILE_BUILD_NUMBER_BASE }}- EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}- ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}- ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}- ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}- ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}- IOS_DISTRIBUTION_P12_BASE64: ${{ secrets.IOS_DISTRIBUTION_P12_BASE64 }}- IOS_DISTRIBUTION_P12_PASSWORD: ${{ secrets.IOS_DISTRIBUTION_P12_PASSWORD }}- IOS_PROVISION_PROFILE_BASE64: ${{ secrets.IOS_PROVISION_PROFILE_BASE64 }}- GOOGLE_PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}- ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}- ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}- ASC_PRIVATE_KEY: ${{ secrets.ASC_PRIVATE_KEY }}- run: node tooling/mobile/release.ts- - name: Select platforms- id: platforms- env:- PLATFORM: ${{ inputs.platform }}- run: |- if [[ "$PLATFORM" == all ]]; then- echo 'platforms=["android","ios"]' >> "$GITHUB_OUTPUT"- else- jq -cn --arg platform "$PLATFORM" '{platforms: [$platform]}' \- | jq -r '"platforms=" + (.platforms | tojson)' >> "$GITHUB_OUTPUT"- fi+ run: node tooling/mobile/release.ts --preparebuild:needs: prepare+ environment: mobile-signingstrategy:fail-fast: falsematrix:@@ -112,6 +103,8 @@ jobs:java-version: "17"- uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4if: matrix.platform == 'android'+ with:+ packages: platform-tools platforms;android-37.0 build-tools;37.0.0 ndk;27.1.12297006 ndk;28.2.13676358 cmake;3.22.1- run: pnpm install --frozen-lockfile- name: Check mobile sourcerun: |@@ -121,9 +114,22 @@ jobs:with:eas-version: 25.2.0token: ${{ secrets.EXPO_TOKEN }}+ - name: Validate signing credentials after approval+ env:+ UPLOAD: "false"+ MOBILE_BUILD_NUMBER_BASE: ${{ vars.MOBILE_BUILD_NUMBER_BASE }}+ EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}+ ANDROID_KEYSTORE_BASE64: ${{ matrix.platform == 'android' && secrets.ANDROID_KEYSTORE_BASE64 || '' }}+ ANDROID_KEYSTORE_PASSWORD: ${{ matrix.platform == 'android' && secrets.ANDROID_KEYSTORE_PASSWORD || '' }}+ ANDROID_KEY_ALIAS: ${{ matrix.platform == 'android' && secrets.ANDROID_KEY_ALIAS || '' }}+ ANDROID_KEY_PASSWORD: ${{ matrix.platform == 'android' && secrets.ANDROID_KEY_PASSWORD || '' }}+ IOS_DISTRIBUTION_P12_BASE64: ${{ matrix.platform == 'ios' && secrets.IOS_DISTRIBUTION_P12_BASE64 || '' }}+ IOS_DISTRIBUTION_P12_PASSWORD: ${{ matrix.platform == 'ios' && secrets.IOS_DISTRIBUTION_P12_PASSWORD || '' }}+ IOS_PROVISION_PROFILE_BASE64: ${{ matrix.platform == 'ios' && secrets.IOS_PROVISION_PROFILE_BASE64 || '' }}+ run: node tooling/mobile/release.ts- name: Fetch reviewed native Forme binariesrun: node packages/forme-native/scripts/fetch-prebuilt.mjs --platform "$PLATFORM"- - name: Build signed store binary with production environment+ - name: Build signed binary with selected update environmentworking-directory: apps/mobileenv:ANDROID_KEYSTORE_BASE64: ${{ matrix.platform == 'android' && secrets.ANDROID_KEYSTORE_BASE64 || '' }}@@ -134,32 +140,58 @@ jobs:IOS_DISTRIBUTION_P12_PASSWORD: ${{ matrix.platform == 'ios' && secrets.IOS_DISTRIBUTION_P12_PASSWORD || '' }}IOS_PROVISION_PROFILE_BASE64: ${{ matrix.platform == 'ios' && secrets.IOS_PROVISION_PROFILE_BASE64 || '' }}run: |- eas env:exec production --non-interactive \- 'pnpm exec expo prebuild --platform "$PLATFORM" --clean --no-install && cd ../../tooling/mobile && bundle exec fastlane "$PLATFORM" build'+ eas env:exec "$MOBILE_UPDATE_CHANNEL" --non-interactive \+ 'pnpm exec expo prebuild --platform "$PLATFORM" --clean --no-install && cd ../../tooling/mobile && if [ "$FORMAT" = apk ]; then bundle exec fastlane android build abi:"$ABI"; else bundle exec fastlane "$PLATFORM" build; fi'+ - name: Verify APK signature and architecture+ if: inputs.format == 'apk'+ run: |+ set -euo pipefail+ apk="$RUNNER_TEMP/mobile-release/reactive-resume-$ABI.apk"+ "$ANDROID_HOME/build-tools/37.0.0/apksigner" verify --verbose --print-certs "$apk"+ abis=$(unzip -Z1 "$apk" | awk -F/ '/^lib\/[^/]+\/.*\.so$/ {print $2}' | sort -u)+ [[ "$abis" == "$ABI" ]]+ unzip -Z1 "$apk" > "$RUNNER_TEMP/apk-entries.txt"+ grep -Fx "lib/$ABI/libforme_native.so" "$RUNNER_TEMP/apk-entries.txt"+- name: Record native runtime fingerprintworking-directory: apps/mobilerun: |- eas fingerprint:generate --platform "$PLATFORM" --environment production --json --non-interactive \+ eas fingerprint:generate --platform "$PLATFORM" --environment "$MOBILE_UPDATE_CHANNEL" --json --non-interactive \> "$RUNNER_TEMP/mobile-release/fingerprint.json"jq -n --arg sha "$GITHUB_SHA" --arg platform "$PLATFORM" --arg build "$MOBILE_BUILD_NUMBER" \+ --arg format "$FORMAT" --arg abi "$ABI" --arg channel "$MOBILE_UPDATE_CHANNEL" \--arg xcode "$(if [[ "$PLATFORM" == ios ]]; then xcodebuild -version; fi)" \- '{commit: $sha, platform: $platform, buildNumber: $build, channel: "production", xcode: $xcode}' \+ '{commit: $sha, platform: $platform, buildNumber: $build, format: $format, abi: $abi, channel: $channel, xcode: $xcode}' \> "$RUNNER_TEMP/mobile-release/release.json"- - name: Save signed binary and debugging artifacts+ - name: Save signed binaryuses: actions/upload-artifact@v7with:name: mobile-${{ matrix.platform }}-${{ needs.prepare.outputs.build_number }}- path: ${{ runner.temp }}/mobile-release/+ path: |+ ${{ runner.temp }}/mobile-release/*.apk+ ${{ runner.temp }}/mobile-release/*.aab+ ${{ runner.temp }}/mobile-release/*.ipaif-no-files-found: error- retention-days: 14+ retention-days: ${{ inputs.format == 'apk' && 14 || 90 }}+ - name: Archive release manifest, fingerprint, symbols and mappings+ uses: actions/upload-artifact@v7+ with:+ name: mobile-${{ matrix.platform }}-${{ needs.prepare.outputs.build_number }}-evidence+ path: |+ ${{ runner.temp }}/mobile-release/+ !${{ runner.temp }}/mobile-release/*.apk+ !${{ runner.temp }}/mobile-release/*.aab+ !${{ runner.temp }}/mobile-release/*.ipa+ if-no-files-found: error+ retention-days: 90- name: Summarize buildrun: |echo "### $PLATFORM build $MOBILE_BUILD_NUMBER" >> "$GITHUB_STEP_SUMMARY"- echo "Commit: $GITHUB_SHA. OTA channel: production. Fingerprint and debugging artifacts attached to this run." >> "$GITHUB_STEP_SUMMARY"+ echo "Commit: $GITHUB_SHA. Format: $FORMAT. OTA channel: $MOBILE_UPDATE_CHANNEL. Release evidence retained for 90 days." >> "$GITHUB_STEP_SUMMARY"upload:needs: [prepare, build]- if: inputs.upload+ if: inputs.upload && inputs.format == 'store'environment: mobile-storestrategy:fail-fast: false@@ -174,6 +206,9 @@ jobs:- uses: useblacksmith/checkout@v1with:persist-credentials: false+ - uses: actions/setup-node@v7+ with:+ node-version-file: .nvmrc- uses: ruby/setup-ruby@v1with:ruby-version: "3.3"@@ -191,4 +226,6 @@ jobs:ASC_KEY_ID: ${{ matrix.platform == 'ios' && secrets.ASC_KEY_ID || '' }}ASC_ISSUER_ID: ${{ matrix.platform == 'ios' && secrets.ASC_ISSUER_ID || '' }}ASC_PRIVATE_KEY: ${{ matrix.platform == 'ios' && secrets.ASC_PRIVATE_KEY || '' }}- run: bundle exec fastlane "$PLATFORM" upload+ run: |+ node release.ts --upload+ bundle exec fastlane "$PLATFORM" uploaddiff --git a/AGENTS.md b/AGENTS.mdindex f16108cab..7fb0ea6c1 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -133,6 +133,7 @@ Narrow cross-cutting helpers go in `packages/utils` only after checking no domai- **Feature parity is required.** The web app and the native mobile app must always offer the same user-facing features. A change that adds, removes, or changes a feature in `apps/web` must make the matching change in `apps/mobile` in the same work, and the reverse. Share logic through workspace packages (`packages/api`, `packages/schema`, `packages/resume`, `packages/pdf`) rather than duplicating it. An exception forced by store policy (for example, the hidden iOS Donate row) needs the owner's explicit decision and a note in `.agents/docs/mobile-release-handoff.md`.- **Over-the-air update or new store build.** The runtime version uses an Expo fingerprint (`apps/mobile/fingerprint.config.js`). JavaScript, styling, copy, translation, and bundled-asset changes ship as an EAS Update: a stable Docker release publishes it to the `production` channel automatically, and no store submission is needed. A change to native code needs a new store build: native dependencies or config plugins, permissions or entitlements, `app.config.ts` native fields (icon, splash, schemes, associated domains), Expo SDK upgrades, `apps/mobile/patches`, or Forme native sources and `packages/forme-native/scripts/prebuilt.json`. Run `eas fingerprint:compare <installed native fingerprint hash> --environment production` from `apps/mobile` to check; save each Blacksmith build's `fingerprint.json` with the store release record. A changed fingerprint means a new store build. Native binaries and optional store uploads use `.github/workflows/mobile-release.yml` on Blacksmith, not EAS Build/Submit. Setup: `.agents/docs/mobile-ci.md`. Release steps: `.agents/docs/mobile-release-handoff.md` → **Releasing a new version**.+- **Manual APKs and release gates.** `mobile-release.yml` supports `format=store|apk`; APKs require `platform=android`, one `abi`, and `upload=false`. Signing requires the `mobile-signing` approval; store uploads require a separate `mobile-store` approval. APK artifacts expire after 14 days; store binaries and release evidence expire after 90 days. Export evidence to permanent release records before expiry. Docker main pushes never build APKs or create Git tags/GitHub Releases. Promotion requires successful latest `e2e.yml` main-push CI at the exact full source SHA before aliases or production move; keep the backend-revision health gate before production OTA.- Old binaries and old OTA bundles stay in use for weeks. Keep API changes backward compatible, and deploy the backend before releasing mobile changes that depend on it. Never bump the runtime version to force an incompatible update onto old binaries.## Package boundariesdiff --git a/tooling/docker/check-ci.mjs b/tooling/docker/check-ci.mjsnew file mode 100644index 000000000..7230ceae4--- /dev/null+++ b/tooling/docker/check-ci.mjs@@ -0,0 +1,19 @@+export async function requireSuccessfulCI({ github, repo, sha }) {+ if (!/^[a-f0-9]{40}$/.test(sha ?? "")) throw new Error("Promotion requires a full commit SHA");+ const runs = await github.paginate(github.rest.actions.listWorkflowRuns, {+ ...repo,+ workflow_id: "e2e.yml",+ head_sha: sha,+ event: "push",+ branch: "main",+ per_page: 100,+ });+ const latest = runs+ .filter((run) => run.head_sha === sha && run.event === "push" && run.head_branch === "main")+ .sort((a, b) => b.run_number - a.run_number || b.run_attempt - a.run_attempt)[0];+ // Manual smoke-only runs and PR checks cannot authorize production promotion.+ if (!latest || latest.status !== "completed" || latest.conclusion !== "success") {+ throw new Error(`Promotion blocked: latest main-push CI for ${sha} must complete successfully`);+ }+ return latest.html_url;+}diff --git a/tooling/docker/check-ci.test.mjs b/tooling/docker/check-ci.test.mjsnew file mode 100644index 000000000..5f4ae0863--- /dev/null+++ b/tooling/docker/check-ci.test.mjs@@ -0,0 +1,43 @@+import { expect, it } from "vite-plus/test";+import { requireSuccessfulCI } from "./check-ci.mjs";++const sha = "a".repeat(40);+const passed = {+ head_sha: sha,+ event: "push",+ head_branch: "main",+ run_number: 1,+ run_attempt: 1,+ status: "completed",+ conclusion: "success",+ html_url: "https://github.com/example/app/actions/runs/1",+};++function authorize(runs) {+ return requireSuccessfulCI({+ github: { rest: { actions: { listWorkflowRuns() {} } }, paginate: async () => runs },+ repo: { owner: "example", repo: "app" },+ sha,+ });+}++it("accepts successful main-push CI at the exact commit", async () => {+ await expect(authorize([passed])).resolves.toBe(passed.html_url);+});++it.each(+ [+ [],+ [{ ...passed, head_sha: "b".repeat(40) }],+ [{ ...passed, event: "pull_request" }],+ [{ ...passed, event: "workflow_dispatch" }],+ [{ ...passed, head_branch: "untrusted" }],+ [{ ...passed, conclusion: "failure" }],+ [{ ...passed, conclusion: "cancelled" }],+ [{ ...passed, status: "in_progress", conclusion: null }],+ [passed, { ...passed, run_number: 2, conclusion: "failure" }],+ [passed, { ...passed, run_attempt: 2, status: "queued", conclusion: null }],+ ].map((runs) => ({ runs })),+)("rejects absent, untrusted, stale, or incomplete CI receipts: %j", async ({ runs }) => {+ await expect(authorize(runs)).rejects.toThrow("Promotion blocked");+});diff --git a/tooling/mobile/build_test.rb b/tooling/mobile/build_test.rbindex cd1a274d8..5cabd373f 100644--- a/tooling/mobile/build_test.rb+++ b/tooling/mobile/build_test.rb@@ -4,9 +4,9 @@ require "tmpdir"class AndroidBuildContractattr_reader :gradle_options, :keystore_path- def initialize+ def initialize(fastfile = File.join(__dir__, "fastlane/Fastfile"))@lanes = {}- instance_eval(File.read(File.join(__dir__, "fastlane/Fastfile")), File.join(__dir__, "fastlane/Fastfile"))+ instance_eval(File.read(fastfile), fastfile)enddef desc(_description); end@@ -60,7 +60,15 @@ Dir.mktmpdir do |directory|"ANDROID_KEY_ALIAS" => "fixture-alias","ANDROID_KEY_PASSWORD" => "fixture-key")- contract = AndroidBuildContract.new+ fastfile = File.join(directory, "tooling/mobile/fastlane/Fastfile")+ FileUtils.mkdir_p(File.dirname(fastfile))+ FileUtils.cp(File.join(__dir__, "fastlane/Fastfile"), fastfile)+ %w[mapping native-debug-symbols].each do |kind|+ path = File.join(directory, "apps/mobile/android/app/build/outputs", kind, "release")+ FileUtils.mkdir_p(path)+ File.write(File.join(path, "fixture"), kind)+ end+ contract = AndroidBuildContract.new(fastfile)[nil, "arm64-v8a", "armeabi-v7a", "x86_64"].each do |abi|contract.build(abi ? { abi: abi } : {})options = contract.gradle_options@@ -72,6 +80,9 @@ Dir.mktmpdir do |directory|expected = abi ? "signed APK" : "signed AAB"raise "Wrong artifact" unless File.read(File.join(directory, "mobile-release", name)) == expectedend+ %w[mapping native-debug-symbols].each do |kind|+ raise "Missing #{kind} archive" unless File.read(File.join(directory, "mobile-release", kind, "fixture")) == kind+ endbegincontract.build(abi: "invalid")raise "Invalid ABI accepted"@@ -80,4 +91,4 @@ Dir.mktmpdir do |directory|endend-puts "Android build contract passed: store AAB, three nightly APK ABIs, signing cleanup, invalid ABI rejection."+puts "Android build contract passed: store AAB, three manual APK ABIs, debug evidence, signing cleanup, invalid ABI rejection."diff --git a/tooling/mobile/fastlane/Fastfile b/tooling/mobile/fastlane/Fastfileindex bc1c916ed..c80c2856f 100644--- a/tooling/mobile/fastlane/Fastfile+++ b/tooling/mobile/fastlane/Fastfile@@ -14,7 +14,7 @@ def secret_file(directory, name, value, base64: false)endplatform :android do- desc "Build a signed production App Bundle, or a nightly APK for the requested ABI"+ desc "Build a signed production App Bundle, or a manual APK for the requested ABI"lane :build do |options|abi = options[:abi]UI.user_error!("Unsupported Android ABI") if abi && !%w[arm64-v8a armeabi-v7a x86_64].include?(abi)@@ -37,6 +37,10 @@ platform :android doFileUtils.cp(source, File.join(OUTPUT, name))maps = File.join(MOBILE, "android/app/build/generated/sourcemaps/react/release")FileUtils.cp_r(maps, File.join(OUTPUT, "sourcemaps")) if Dir.exist?(maps)+ %w[mapping native-debug-symbols].each do |kind|+ source = File.join(MOBILE, "android/app/build/outputs", kind, "release")+ FileUtils.cp_r(source, File.join(OUTPUT, kind)) if Dir.exist?(source)+ endendend@@ -111,6 +115,8 @@ platform :ios doprovisioningProfiles: { "me.rxresu" => profile_data.fetch("UUID") }})+ symbols = File.join(ENV.fetch("RUNNER_TEMP"), "ReactiveResume.xcarchive/dSYMs")+ FileUtils.cp_r(symbols, File.join(OUTPUT, "dSYMs")) if Dir.exist?(symbols)ensureFileUtils.rm_f(installed)enddiff --git a/tooling/mobile/release.test.ts b/tooling/mobile/release.test.tsindex 0be4cece4..8443dcc00 100644--- a/tooling/mobile/release.test.ts+++ b/tooling/mobile/release.test.ts@@ -4,7 +4,7 @@ import { tmpdir } from "node:os";import { join } from "node:path";import { fileURLToPath } from "node:url";import { expect, it } from "vite-plus/test";-import { buildNumber, validateRelease } from "./release";+import { buildNumber, prepareRelease, validateRelease, validateUpload } from "./release";const version = { MOBILE_BUILD_NUMBER_BASE: "100", GITHUB_RUN_NUMBER: "1", GITHUB_RUN_ATTEMPT: "1" };const android = {@@ -59,6 +59,38 @@ it("requires signing before build, and store credentials only when uploading", (expect(() => validateRelease({ ...ios, UPLOAD: "true" })).toThrow("ASC_KEY_ID, ASC_ISSUER_ID, ASC_PRIVATE_KEY");});+it("prepares store or APK builds without reading signing or publishing credentials", () => {+ expect(prepareRelease({ ...version, PLATFORM: "all", UPLOAD: "false" })).toEqual({+ buildNumber: 100,+ platforms: ["android", "ios"],+ });+ expect(prepareRelease({ ...version, PLATFORM: "android", FORMAT: "apk", ABI: "arm64-v8a", UPLOAD: "false" })).toEqual(+ { buildNumber: 100, platforms: ["android"] },+ );+});++it.each([{ PLATFORM: "ios" }, { PLATFORM: "all" }, { ABI: "invalid" }, { UPLOAD: "true" }, { FORMAT: "invalid" }])(+ "rejects invalid APK requests before signing: %j",+ (override) => {+ expect(() =>+ prepareRelease({+ ...version,+ PLATFORM: "android",+ FORMAT: "apk",+ ABI: "arm64-v8a",+ UPLOAD: "false",+ ...override,+ }),+ ).toThrow();+ },+);++it("validates store uploads independently of signing and rejects APK uploads", () => {+ expect(() => validateUpload({ PLATFORM: "android", GOOGLE_PLAY_SERVICE_ACCOUNT_JSON: "fixture" })).not.toThrow();+ expect(() => validateUpload({ PLATFORM: "ios" })).toThrow("ASC_KEY_ID, ASC_ISSUER_ID, ASC_PRIVATE_KEY");+ expect(() => validateUpload({ PLATFORM: "android", FORMAT: "apk" })).toThrow("cannot upload to stores");+});+it("CLI emits only validated version output and never echoes credential values on failure", () => {const directory = mkdtempSync(join(tmpdir(), "mobile-release-"));const script = fileURLToPath(new URL("./release.ts", import.meta.url));@@ -68,6 +100,13 @@ it("CLI emits only validated version output and never echoes credential values oconst valid = spawnSync(process.execPath, [script], { env, encoding: "utf8" });expect(valid.status, valid.stderr).toBe(0);expect(readFileSync(output, "utf8")).toBe("build_number=100\n");+ const preparedOutput = join(directory, "prepared");+ const prepared = spawnSync(process.execPath, [script, "--prepare"], {+ env: { ...process.env, ...version, PLATFORM: "all", UPLOAD: "false", GITHUB_OUTPUT: preparedOutput },+ encoding: "utf8",+ });+ expect(prepared.status, prepared.stderr).toBe(0);+ expect(readFileSync(preparedOutput, "utf8")).toBe('build_number=100\nplatforms=["android","ios"]\n');const invalid = spawnSync(process.execPath, [script], {env: { ...env, PLATFORM: "untrusted", ANDROID_KEYSTORE_PASSWORD: "private-fixture" },encoding: "utf8",diff --git a/tooling/mobile/release.ts b/tooling/mobile/release.tsindex 60646e3fd..44ff81e30 100644--- a/tooling/mobile/release.ts+++ b/tooling/mobile/release.ts@@ -20,28 +20,61 @@ export function buildNumber(env: NodeJS.ProcessEnv) {return number;}-export function validateRelease(env: NodeJS.ProcessEnv) {+export function prepareRelease(env: NodeJS.ProcessEnv) {if (!["all", "android", "ios"].includes(env.PLATFORM ?? "")) throw new Error("Invalid release platform");if (!["true", "false"].includes(env.UPLOAD ?? "")) throw new Error("UPLOAD must be true or false");+ const format = env.FORMAT ?? "store";+ if (!["store", "apk"].includes(format)) throw new Error("Invalid release format");+ if (format === "apk") {+ if (env.PLATFORM !== "android" || env.UPLOAD !== "false") {+ throw new Error("APK builds require Android and cannot upload to stores");+ }+ if (!["arm64-v8a", "armeabi-v7a", "x86_64"].includes(env.ABI ?? "")) throw new Error("Invalid APK ABI");+ }+ return {+ buildNumber: buildNumber(env),+ platforms: env.PLATFORM === "all" ? ["android", "ios"] : [env.PLATFORM],+ };+}++export function validateUpload(env: NodeJS.ProcessEnv) {+ if (!["all", "android", "ios"].includes(env.PLATFORM ?? "")) throw new Error("Invalid release platform");+ if ((env.FORMAT ?? "store") !== "store") throw new Error("APK builds cannot upload to stores");+ const required: string[] = [];+ if (env.PLATFORM !== "ios") required.push("GOOGLE_PLAY_SERVICE_ACCOUNT_JSON");+ if (env.PLATFORM !== "android") required.push("ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_PRIVATE_KEY");+ const missing = required.filter((name) => !env[name]?.trim());+ if (missing.length) throw new Error(`Missing Actions secrets: ${missing.join(", ")}`);+}++export function validateRelease(env: NodeJS.ProcessEnv) {+ const plan = prepareRelease(env);const required = ["EXPO_TOKEN"];if (env.PLATFORM !== "ios") {required.push("ANDROID_KEYSTORE_BASE64", "ANDROID_KEYSTORE_PASSWORD", "ANDROID_KEY_ALIAS", "ANDROID_KEY_PASSWORD");- if (env.UPLOAD === "true") required.push("GOOGLE_PLAY_SERVICE_ACCOUNT_JSON");}if (env.PLATFORM !== "android") {required.push("IOS_DISTRIBUTION_P12_BASE64", "IOS_DISTRIBUTION_P12_PASSWORD", "IOS_PROVISION_PROFILE_BASE64");- if (env.UPLOAD === "true") required.push("ASC_KEY_ID", "ASC_ISSUER_ID", "ASC_PRIVATE_KEY");}const missing = required.filter((name) => !env[name]?.trim());if (missing.length) throw new Error(`Missing Actions secrets: ${missing.join(", ")}`);- return buildNumber(env);+ if (env.UPLOAD === "true") validateUpload(env);+ return plan.buildNumber;}if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {try {- const number = validateRelease(process.env);- if (!process.env.GITHUB_OUTPUT) throw new Error("GITHUB_OUTPUT is required");- appendFileSync(process.env.GITHUB_OUTPUT, `build_number=${number}\n`);+ if (process.argv.includes("--upload")) {+ validateUpload(process.env);+ } else {+ const plan = process.argv.includes("--prepare") ? prepareRelease(process.env) : null;+ const number = plan ? plan.buildNumber : validateRelease(process.env);+ if (!process.env.GITHUB_OUTPUT) throw new Error("GITHUB_OUTPUT is required");+ appendFileSync(+ process.env.GITHUB_OUTPUT,+ `build_number=${number}\n${plan ? `platforms=${JSON.stringify(plan.platforms)}\n` : ""}`,+ );+ }} catch (error) {console.error(error instanceof Error ? error.message : "Mobile release preparation failed");process.exitCode = 1;diff --git a/tooling/releases/nightly.mjs b/tooling/releases/nightly.mjsdeleted file mode 100644index 3093e9501..000000000--- a/tooling/releases/nightly.mjs+++ /dev/null@@ -1,151 +0,0 @@-import { execFileSync } from "node:child_process";-import { createHash } from "node:crypto";-import { readFile, writeFile } from "node:fs/promises";-import { join } from "node:path";--export const androidAbis = ["arm64-v8a", "armeabi-v7a", "x86_64"];--export function getPushCommits({ before, sha, cwd = process.cwd() }) {- if (!/^[a-f0-9]{40}$/.test(sha) || !/^[a-f0-9]{40}$/.test(before)) {- throw new Error("Expected full commit SHAs from a push event");- }- const git = (...args) => execFileSync("git", args, { cwd, encoding: "utf8", maxBuffer: 16 * 1024 * 1024 }).trim();- // A newly created main branch has no previous tip. Include its head rather than the entire repository history.- const range = /^0+$/.test(before) ? ["--max-count=1", sha] : [`${before}..${sha}`];- return git("rev-list", "--reverse", ...range, "--")- .split("\n")- .filter(Boolean)- .map((commit) => ({ sha: commit, message: git("show", "-s", "--format=%B", commit, "--") }));-}--export async function buildChangelog({ github, repo, commits, sha, before, serverUrl, runId }) {- const url = `${serverUrl}/${repo.owner}/${repo.repo}`;- const pulls = new Map();- for (const commit of commits) {- const associated = await github.paginate(github.rest.repos.listPullRequestsAssociatedWithCommit, {- ...repo,- commit_sha: commit.sha,- per_page: 100,- });- for (const pull of associated) {- if (pull.merged_at && pull.base.ref === "main") pulls.set(pull.number, pull);- }- }- const lines = [- `Nightly build of [\`${sha}\`](${url}/commit/${sha}) from main.`,- `[Build logs](${url}/actions/runs/${runId}) · Docker: \`ghcr.io/${repo.owner.toLowerCase()}/${repo.repo.toLowerCase()}:sha-${sha}\``,- "",- "## Android downloads",- "",- "Choose the APK matching your device: arm64-v8a (64-bit ARM), armeabi-v7a (32-bit ARM), or x86_64 (64-bit Intel/AMD). Verify downloads against SHA256SUMS.",- "",- "APKs use the existing Android upload signing key and the preview update channel. Play Store installs may use a different signing key and cannot be upgraded with these APKs. Back up local drafts before switching distributions.",- "",- "## Commits in this push",- "",- ];- if (!/^0+$/.test(before)) lines.push(`[Compare changes](${url}/compare/${before}...${sha})`, "");- for (const commit of commits) {- lines.push(`### [\`${commit.sha.slice(0, 7)}\`](${url}/commit/${commit.sha})`, "");- lines.push(...commit.message.split("\n").map((line) => `> ${line}`), "");- }- lines.push("## Pull request summaries", "");- if (pulls.size === 0) lines.push("No merged pull requests associated with these commits.", "");- for (const pull of pulls.values()) {- const title = pull.title.replace(/[\r\n]/g, " ").replace(/[\\`*_[\]<>]/g, "\\$&");- lines.push(- `### [#${pull.number}](${pull.html_url}) ${title}`,- "",- pull.body?.trim() || "No description provided.",- "",- );- }- return lines.join("\n");-}--export async function publishNightly({ github, context, artifactDir, sourceDir = process.cwd() }) {- if (context.eventName !== "push" || context.ref !== "refs/heads/main") {- throw new Error("Nightly releases require a push to main");- }- const repo = context.repo;- const sha = context.sha;- const tag = `nightly-${context.runId}`;- const names = androidAbis.map((abi) => `reactive-resume-${abi}.apk`);- // Read every required artifact before creating a release; partial matrices must never publish.- const apks = await Promise.all(names.map((name) => readFile(join(artifactDir, name))));- if (apks.some((apk) => apk.length === 0)) throw new Error("Empty APK artifact");- const checksums = apks- .map((apk, index) => `${createHash("sha256").update(apk).digest("hex")} ${names[index]}\n`)- .join("");- await writeFile(join(artifactDir, "SHA256SUMS"), checksums);-- let release;- try {- release = (await github.rest.repos.getReleaseByTag({ ...repo, tag })).data;- } catch (error) {- if (error.status !== 404) throw error;- }- if (release) {- if (release.target_commitish !== sha || !release.prerelease)- throw new Error("Existing release does not match build");- // Published assets stay immutable on reruns, including repositories enforcing release immutability.- if (!release.draft) return release.html_url;- }-- const before = context.payload.before;- const commits = getPushCommits({ before, sha, cwd: sourceDir });- const changelog = await buildChangelog({- github,- repo,- commits,- sha,- before,- serverUrl: context.serverUrl,- runId: context.runId,- });- await writeFile(join(artifactDir, "CHANGELOG.md"), changelog);- const body =- changelog.length <= 60_000- ? changelog- : `${changelog.slice(0, 59_000)}\n\n[Full changelog](${context.serverUrl}/${repo.owner}/${repo.repo}/releases/download/${tag}/CHANGELOG.md)`;- if (!release) {- release = (- await github.rest.repos.createRelease({- ...repo,- tag_name: tag,- target_commitish: sha,- name: `Nightly ${tag.slice("nightly-".length)} (${sha.slice(0, 7)})`,- body,- draft: true,- prerelease: true,- make_latest: "false",- })- ).data;- }- // A failed upload leaves a recoverable draft. Reruns replace only assets on that draft.- const assets = await github.paginate(github.rest.repos.listReleaseAssets, {- ...repo,- release_id: release.id,- per_page: 100,- });- for (const name of [...names, "SHA256SUMS", "CHANGELOG.md"]) {- const existing = assets.find((asset) => asset.name === name);- if (existing) await github.rest.repos.deleteReleaseAsset({ ...repo, asset_id: existing.id });- await github.rest.repos.uploadReleaseAsset({- ...repo,- release_id: release.id,- name,- headers: { "content-type": name.endsWith(".apk") ? "application/vnd.android.package-archive" : "text/plain" },- data: await readFile(join(artifactDir, name)),- });- }- const published = await github.rest.repos.updateRelease({- ...repo,- release_id: release.id,- body,- draft: false,- prerelease: true,- make_latest: "false",- });- return published.data.html_url;-}diff --git a/tooling/releases/nightly.test.mjs b/tooling/releases/nightly.test.mjsdeleted file mode 100644index 7f1098022..000000000--- a/tooling/releases/nightly.test.mjs+++ /dev/null@@ -1,210 +0,0 @@-import { execFileSync } from "node:child_process";-import { createHash } from "node:crypto";-import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";-import { tmpdir } from "node:os";-import { join } from "node:path";-import { afterEach, expect, it, vi } from "vite-plus/test";-import { androidAbis, buildChangelog, getPushCommits, publishNightly } from "./nightly.mjs";--const directories = [];-afterEach(async () => {- await Promise.all(directories.splice(0).map((directory) => rm(directory, { recursive: true, force: true })));-});--async function temporaryDirectory() {- const directory = await mkdtemp(join(tmpdir(), "nightly-release-"));- directories.push(directory);- return directory;-}--async function repository() {- const cwd = await temporaryDirectory();- const git = (...args) => execFileSync("git", args, { cwd, encoding: "utf8" }).trim();- git("init", "--quiet");- git("config", "user.name", "Release Test");- git("config", "user.email", "[email protected]");- const commit = (message) => {- git("-c", "commit.gpgsign=false", "commit", "--quiet", "--allow-empty", "-m", message);- return git("rev-parse", "HEAD");- };- const before = commit("existing history");- return { cwd, before, commit };-}--function githubFixture() {- const repos = {- listPullRequestsAssociatedWithCommit: vi.fn(async () => ({ data: [] })),- getReleaseByTag: vi.fn(async () => {- throw Object.assign(new Error("Not found"), { status: 404 });- }),- createRelease: vi.fn(async (input) => ({ data: { id: 17, ...input } })),- listReleaseAssets: vi.fn(async () => ({ data: [] })),- deleteReleaseAsset: vi.fn(async () => ({})),- uploadReleaseAsset: vi.fn(async () => ({})),- updateRelease: vi.fn(async () => ({- data: { html_url: "https://github.com/example/resume/releases/tag/nightly-42" },- })),- };- return { rest: { repos }, paginate: vi.fn(async (method, input) => (await method(input)).data) };-}--async function publishingFixture() {- const source = await repository();- const sha = source.commit("fix: export\n\nPreserve all fonts.");- const artifactDir = await temporaryDirectory();- for (const abi of androidAbis) await writeFile(join(artifactDir, `reactive-resume-${abi}.apk`), `signed ${abi}`);- const context = {- eventName: "push",- ref: "refs/heads/main",- repo: { owner: "example", repo: "resume" },- sha,- runId: 42,- serverUrl: "https://github.com",- payload: { before: source.before },- };- return { github: githubFixture(), context, artifactDir, sourceDir: source.cwd };-}--it("reads the complete push from Git, including bodies and more than 20 commits", async () => {- const source = await repository();- const shas = Array.from({ length: 25 }, (_, index) =>- source.commit(`fix: change ${index}\n\nDetailed message ${index}`),- );- const sha = shas.at(-1);- const commits = getPushCommits({ before: source.before, sha, cwd: source.cwd });- expect(commits.map((commit) => commit.sha)).toEqual(shas);- expect(commits.at(-1).message).toBe("fix: change 24\n\nDetailed message 24");- expect(getPushCommits({ before: "0".repeat(40), sha, cwd: source.cwd })).toEqual([commits.at(-1)]);- expect(() => getPushCommits({ before: source.before, sha: "--all", cwd: source.cwd })).toThrow("full commit SHAs");-});--it("includes commit bodies and deduplicated merged main PR summaries, without executing their text", async () => {- const github = githubFixture();- const pull = {- number: 12,- title: "fix: PDF [export]",- html_url: "https://github.com/example/resume/pull/12",- body: "## Summary\n\nPreserve fonts. Literal `$(echo unsafe)` remains text.",- merged_at: "2026-10-22T00:00:00Z",- base: { ref: "main" },- };- github.rest.repos.listPullRequestsAssociatedWithCommit.mockResolvedValue({- data: [pull, { ...pull, number: 13, merged_at: null }, { ...pull, number: 14, base: { ref: "other" } }],- });- const body = await buildChangelog({- github,- repo: { owner: "example", repo: "resume" },- commits: [- { sha: "a".repeat(40), message: "fix: fonts\n\nFull body" },- { sha: "b".repeat(40), message: "fix: layout" },- ],- sha: "b".repeat(40),- before: "c".repeat(40),- serverUrl: "https://github.com",- runId: 42,- });- expect(body).toContain("> fix: fonts\n> \n> Full body");- expect(body).toContain(pull.body);- expect(body.match(/### \[#12\]/g)).toHaveLength(1);- expect(body).not.toContain("### [#13]");- expect(body).not.toContain("### [#14]");- expect(github.paginate).toHaveBeenCalledTimes(2);-});--it("stages all APKs, checksums and full changelog before publishing a prerelease at the exact SHA", async () => {- const fixture = await publishingFixture();- const repos = fixture.github.rest.repos;- await publishNightly(fixture);- expect(repos.createRelease).toHaveBeenCalledWith(- expect.objectContaining({- tag_name: "nightly-42",- target_commitish: fixture.context.sha,- draft: true,- prerelease: true,- make_latest: "false",- }),- );- expect(repos.uploadReleaseAsset.mock.calls.map(([input]) => input.name)).toEqual([- ...androidAbis.map((abi) => `reactive-resume-${abi}.apk`),- "SHA256SUMS",- "CHANGELOG.md",- ]);- const checksum = createHash("sha256").update("signed arm64-v8a").digest("hex");- expect(await readFile(join(fixture.artifactDir, "SHA256SUMS"), "utf8")).toContain(- `${checksum} reactive-resume-arm64-v8a.apk\n`,- );- expect(await readFile(join(fixture.artifactDir, "CHANGELOG.md"), "utf8")).toContain("Preserve all fonts.");- expect(repos.updateRelease).toHaveBeenCalledWith(- expect.objectContaining({ draft: false, prerelease: true, make_latest: "false" }),- );- expect(repos.updateRelease.mock.invocationCallOrder[0]).toBeGreaterThan(- repos.uploadReleaseAsset.mock.invocationCallOrder.at(-1),- );-});--it("withholds publishing after upload failure, then resumes the same draft on rerun", async () => {- const fixture = await publishingFixture();- const repos = fixture.github.rest.repos;- repos.uploadReleaseAsset.mockRejectedValueOnce(new Error("Upload failed"));- await expect(publishNightly(fixture)).rejects.toThrow("Upload failed");- expect(repos.updateRelease).not.toHaveBeenCalled();- repos.getReleaseByTag.mockResolvedValue({- data: { id: 17, target_commitish: fixture.context.sha, prerelease: true, draft: true },- });- repos.listReleaseAssets.mockResolvedValue({ data: [{ id: 9, name: "reactive-resume-arm64-v8a.apk" }] });- await publishNightly(fixture);- expect(repos.createRelease).toHaveBeenCalledTimes(1);- expect(repos.deleteReleaseAsset).toHaveBeenCalledWith(expect.objectContaining({ asset_id: 9 }));- expect(repos.updateRelease).toHaveBeenCalledTimes(1);-});--it("leaves an already published release and its assets untouched on rerun", async () => {- const fixture = await publishingFixture();- const repos = fixture.github.rest.repos;- repos.getReleaseByTag.mockResolvedValue({- data: { id: 17, target_commitish: fixture.context.sha, prerelease: true, draft: false, html_url: "existing" },- });- expect(await publishNightly(fixture)).toBe("existing");- expect(repos.createRelease).not.toHaveBeenCalled();- expect(repos.uploadReleaseAsset).not.toHaveBeenCalled();- expect(repos.updateRelease).not.toHaveBeenCalled();-});--it("attaches oversized changelogs in full while keeping the release description within API limits", async () => {- const fixture = await publishingFixture();- const summary = "Detailed PR summary. ".repeat(4000);- const repos = fixture.github.rest.repos;- repos.listPullRequestsAssociatedWithCommit.mockResolvedValue({- data: [- {- number: 12,- title: "Large change",- body: summary,- html_url: "https://github.com/example/resume/pull/12",- merged_at: "2026-10-22",- base: { ref: "main" },- },- ],- });- await publishNightly(fixture);- expect(repos.createRelease.mock.calls[0][0].body.length).toBeLessThan(60_000);- expect(repos.createRelease.mock.calls[0][0].body).toContain("/nightly-42/CHANGELOG.md");- expect(await readFile(join(fixture.artifactDir, "CHANGELOG.md"), "utf8")).toContain(summary.trim());-});--it("fails on release API authorization errors instead of treating them as missing releases", async () => {- const fixture = await publishingFixture();- const repos = fixture.github.rest.repos;- repos.getReleaseByTag.mockRejectedValue(Object.assign(new Error("Forbidden"), { status: 403 }));- await expect(publishNightly(fixture)).rejects.toThrow("Forbidden");- expect(repos.createRelease).not.toHaveBeenCalled();-});--it("rejects incomplete APK matrices and non-main events before creating a release", async () => {- const fixture = await publishingFixture();- await rm(join(fixture.artifactDir, "reactive-resume-x86_64.apk"));- await expect(publishNightly(fixture)).rejects.toThrow("ENOENT");- fixture.context.ref = "refs/heads/other";- await expect(publishNightly(fixture)).rejects.toThrow("push to main");- expect(fixture.github.rest.repos.createRelease).not.toHaveBeenCalled();-});