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(mobile): publish OTA updates only from stable releases
Amruth Pillaib68c7a12a4ba
diff --git a/.agents/docs/container-publishing.md b/.agents/docs/container-publishing.mdindex b661d7fc6..e68b79a51 100644--- a/.agents/docs/container-publishing.md+++ b/.agents/docs/container-publishing.md@@ -36,7 +36,7 @@ outputs use `sha-<full-commit>-amd64` and `sha-<full-commit>-arm64`.### Explicit product releases and manual APKs-A push to `main` publishes container images and compatible preview OTA updates only.+A push to `main` publishes container images only. OTA updates ship with stable production releases.It never builds Android APKs, creates Git tags, or creates GitHub Releases. ProductGitHub 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.@@ -95,20 +95,24 @@ secret is missing. Dispatch does not create a Git tag, GitHub release, or versio## Native mobile updates-After successful GHCR publishing, `mobile-update` checks out the same full commit and-publishes an EAS Update using the `EXPO_TOKEN` Actions secret. The token must have access-to Expo account `reactive-resume` and project `5830280e-e1ba-45b7-b9c9-ba048fa3bd4d`.-Missing credentials fail the mobile job without undoing the published Docker image.--- Current-main nightlies, manual canaries, and prereleases publish to the `preview` channel- using the `preview` EAS environment. Superseded main builds skip mobile publishing.-- Stable promotions publish to `production` using the `production` EAS environment only- when the SSH redeploy step succeeded. Before publishing, three consecutive probes of- `https://rxresu.me/api/health` must identify this service, report healthy, and match the- full source commit. Official Docker builds embed `APP_REVISION` for that check.-- Each channel cancels superseded mobile jobs independently; Docker image builds remain- unaffected. Publishing and deployment are separate operations, so a failed mobile job- can leave the backend ahead. Fix the failure and rerun the release workflow.+After a successful stable Docker promotion and SSH redeploy, `docker-build.yml` calls+`.github/workflows/mobile-ota-update.yml`. This reusable workflow checks out the image's+exact full source commit and publishes an EAS Update to the `production` channel using+the `production` EAS environment. Nightlies, manual canaries, and prereleases skip OTA.++The workflow uses the `EXPO_TOKEN` Actions secret, which must have access to Expo account+`reactive-resume` and project `5830280e-e1ba-45b7-b9c9-ba048fa3bd4d`. Missing credentials+fail the mobile job without undoing the published Docker image.++Before publishing, three consecutive probes of `https://rxresu.me/api/health` must identify+this service, report healthy, and match the full source commit. Official Docker builds+embed `APP_REVISION` for that check. A successful container publish alone cannot authorize OTA.++New production OTA jobs cancel superseded OTA jobs; Docker image builds remain unaffected.+Publishing and deployment are separate operations, so a failed mobile job can leave the+backend ahead. Fix the failure and rerun failed jobs in the Docker release run. The reusable+workflow runs within that release's dependency chain; it has no independent push or+`workflow_run` trigger and receives only the source SHA and Expo secret from its caller.The app uses `expo-updates` with fingerprint runtime compatibility. Generated nativeprojects and local Forme build output are excluded; the Rust sources and reviewed@@ -116,8 +120,8 @@ prebuilt pin are included. Native changes need a new compatible store build; puban OTA update alone cannot upgrade native code. JavaScript and asset changes are checkedat launch, downloaded in the background, and applied on the next restart.-Before first use, add `EXPO_TOKEN`, create preview/production EAS channels, and distribute-new builds with these channels and update configuration. Existing binaries without+Before first use, add `EXPO_TOKEN`, create the production EAS channel, and distribute+new production builds with that channel and update configuration. Existing binaries without`expo-updates` cannot receive OTA updates. See [mobile release handoff](./mobile-release-handoff.md#over-the-air-updates)for setup, rollback, and remaining verification. Keep APIs compatible with older clientsand self-hosted servers; runtime fingerprints only protect the JavaScript/native boundary.diff --git a/.agents/docs/mobile-release-handoff.md b/.agents/docs/mobile-release-handoff.mdindex 432108d0b..3f2ffb4ed 100644--- a/.agents/docs/mobile-release-handoff.md+++ b/.agents/docs/mobile-release-handoff.md@@ -81,9 +81,9 @@ One-time activation:store build, open it to download, then restart to apply. Verify startup offline andsaved drafts. Repeat on iOS and Android. Existing preview binaries keep their channel.-The Docker workflow publishes from the image's exact source commit: non-production-images go to preview, stable releases to production after SSH deployment and three-matching healthy commit probes. Production deployment must expose `/api/health` from+The Docker workflow calls `mobile-ota-update.yml` only for stable production releases,+using the image's exact source commit after successful SSH deployment. Nightlies, canaries,+and prereleases skip OTA. The OTA workflow requires three matching healthy commit probes. Production deployment must expose `/api/health` fromthe application without caching or substituting a proxy's `OK` response. A missing`APP_REVISION`, old replica, or unhealthy backend withholds the mobile update. A timeoutor missing `EXPO_TOKEN` fails the mobile job; Docker publishing is not rolled back.diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.ymlindex 591fcb37e..9350bbd5c 100644--- a/.github/workflows/docker-build.yml+++ b/.github/workflows/docker-build.yml@@ -185,7 +185,7 @@ jobs:outputs:sha: ${{ steps.version.outputs.sha }}- mobile_channel: ${{ steps.mobile.outputs.channel }}+ mobile_ota: ${{ needs.mode.outputs.release == 'true' && steps.version.outputs.prerelease != 'true' && steps.deploy.outcome == 'success' }}env:DEPLOY: ${{ secrets.SSH_KEY != '' && secrets.SSH_HOST != '' && secrets.SSH_USER != '' }}@@ -455,109 +455,13 @@ jobs:echo "Cloudflare cache purged successfully."- - name: Select mobile update channel- id: mobile- env:- RELEASE: ${{ needs.mode.outputs.release }}- NIGHTLY: ${{ needs.mode.outputs.nightly }}- PRERELEASE: ${{ steps.version.outputs.prerelease }}- DEPLOYED: ${{ steps.deploy.outcome }}- COMMIT_SHA: ${{ steps.version.outputs.sha }}- run: |- set -euo pipefail- if [[ "$RELEASE" == "true" && "$PRERELEASE" != "true" ]]; then- if [[ "$DEPLOYED" != "success" ]]; then- echo "::notice::Production mobile update skipped: backend deployment did not run."- exit 0- fi- channel=production- else- if [[ "$NIGHTLY" == "true" && "$COMMIT_SHA" != "$(git ls-remote --exit-code origin refs/heads/main | cut -f1)" ]]; then- echo "::notice::Preview mobile update skipped: a newer main commit exists."- exit 0- fi- channel=preview- fi- echo "channel=$channel" >> "$GITHUB_OUTPUT"-- mobile-update:+ mobile-ota-update:needs: merge- if: ${{ !cancelled() && needs.merge.result == 'success' && needs.merge.outputs.mobile_channel != '' }}- runs-on: ${{ vars.USE_BLACKSMITH == 'true' && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}- timeout-minutes: 20+ if: ${{ !cancelled() && needs.merge.result == 'success' && needs.merge.outputs.mobile_ota == 'true' }}permissions:contents: read- concurrency:- group: mobile-update-${{ needs.merge.outputs.mobile_channel }}- cancel-in-progress: true- env:- EXPO_NO_TELEMETRY: "1"- UPDATE_CHANNEL: ${{ needs.merge.outputs.mobile_channel }}- COMMIT_SHA: ${{ needs.merge.outputs.sha }}-- steps:- - name: Check Expo publishing credential- env:- EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}- run: |- if [[ -z "$EXPO_TOKEN" ]]; then- echo "::error::Add the EXPO_TOKEN Actions secret with access to the reactive-resume Expo project."- exit 1- fi-- - name: Checkout Repository- if: ${{ vars.USE_BLACKSMITH != 'true' }}- uses: actions/checkout@v7- with: &checkout-mobile-update- ref: ${{ needs.merge.outputs.sha }}- persist-credentials: false-- - name: Checkout Repository (Blacksmith)- if: ${{ vars.USE_BLACKSMITH == 'true' }}- uses: useblacksmith/checkout@v1- with: *checkout-mobile-update-- - name: Install pnpm- uses: pnpm/action-setup@v6-- - name: Setup Node- uses: actions/setup-node@v7- with:- node-version-file: .nvmrc- cache: pnpm-- - name: Install Dependencies- run: pnpm install --frozen-lockfile-- - name: Typecheck mobile app- run: pnpm --filter mobile typecheck-- - name: Setup EAS- uses: expo/expo-github-action@v9- with:- eas-version: 25.2.0- token: ${{ secrets.EXPO_TOKEN }}-- - name: Wait for matching production backend- if: env.UPDATE_CHANNEL == 'production'- run: |- set -euo pipefail- matches=0- for attempt in $(seq 1 60); do- if curl --fail --silent --show-error --max-time 10 \- -H 'Cache-Control: no-cache' "https://rxresu.me/api/health?revision=$COMMIT_SHA&probe=$attempt" \- | jq --exit-status --arg sha "$COMMIT_SHA" \- '.service == "reactive-resume" and .status == "healthy" and .revision == $sha' > /dev/null; then- matches=$((matches + 1))- if [[ "$matches" -ge 3 ]]; then exit 0; fi- else- matches=0- fi- sleep 5- done- echo "::error::Production backend did not become healthy at commit $COMMIT_SHA; mobile update withheld."- exit 1-- - name: Publish matching mobile update- working-directory: apps/mobile- run: eas update --channel "$UPDATE_CHANNEL" --environment "$UPDATE_CHANNEL" --message "Docker $COMMIT_SHA" --upload-source-maps --non-interactive+ uses: ./.github/workflows/mobile-ota-update.yml+ with:+ sha: ${{ needs.merge.outputs.sha }}+ secrets:+ EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}diff --git a/.github/workflows/mobile-ota-update.yml b/.github/workflows/mobile-ota-update.ymlnew file mode 100644index 000000000..65f739147--- /dev/null+++ b/.github/workflows/mobile-ota-update.yml@@ -0,0 +1,97 @@+name: Mobile OTA Update++on:+ workflow_call:+ inputs:+ sha:+ description: Full source commit of the deployed Docker image+ required: true+ type: string+ secrets:+ EXPO_TOKEN:+ required: true++permissions:+ contents: read++env:+ FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true++jobs:+ mobile-ota-update:+ runs-on: ${{ vars.USE_BLACKSMITH == 'true' && 'blacksmith-2vcpu-ubuntu-2404' || 'ubuntu-latest' }}+ timeout-minutes: 20+ permissions:+ contents: read+ concurrency:+ group: mobile-ota-update-production+ cancel-in-progress: true+ env:+ EXPO_NO_TELEMETRY: "1"+ COMMIT_SHA: ${{ inputs.sha }}++ steps:+ - name: Check Expo publishing credential+ env:+ EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}+ run: |+ if [[ -z "$EXPO_TOKEN" ]]; then+ echo "::error::Add the EXPO_TOKEN Actions secret with access to the reactive-resume Expo project."+ exit 1+ fi++ - name: Checkout Repository+ if: ${{ vars.USE_BLACKSMITH != 'true' }}+ uses: actions/checkout@v7+ with: &checkout-mobile-ota-update+ ref: ${{ inputs.sha }}+ persist-credentials: false++ - name: Checkout Repository (Blacksmith)+ if: ${{ vars.USE_BLACKSMITH == 'true' }}+ uses: useblacksmith/checkout@v1+ with: *checkout-mobile-ota-update++ - name: Install pnpm+ uses: pnpm/action-setup@v6++ - name: Setup Node+ uses: actions/setup-node@v7+ with:+ node-version-file: .nvmrc+ cache: pnpm++ - name: Install Dependencies+ run: pnpm install --frozen-lockfile++ - name: Typecheck mobile app+ run: pnpm --filter mobile typecheck++ - name: Setup EAS+ uses: expo/expo-github-action@v9+ with:+ eas-version: 25.2.0+ token: ${{ secrets.EXPO_TOKEN }}++ - name: Wait for matching production backend+ run: |+ set -euo pipefail+ matches=0+ for attempt in $(seq 1 60); do+ if curl --fail --silent --show-error --max-time 10 \+ -H 'Cache-Control: no-cache' "https://rxresu.me/api/health?revision=$COMMIT_SHA&probe=$attempt" \+ | jq --exit-status --arg sha "$COMMIT_SHA" \+ '.service == "reactive-resume" and .status == "healthy" and .revision == $sha' > /dev/null; then+ matches=$((matches + 1))+ if [[ "$matches" -ge 3 ]]; then exit 0; fi+ else+ matches=0+ fi+ sleep 5+ done+ echo "::error::Production backend did not become healthy at commit $COMMIT_SHA; mobile update withheld."+ exit 1++ - name: Publish matching mobile update+ working-directory: apps/mobile+ run: eas update --channel production --environment production --message "Docker $COMMIT_SHA" --upload-source-maps --non-interactivediff --git a/tooling/mobile-updates.test.ts b/tooling/mobile-updates.test.tsindex 2bd02bc3b..9021d4c39 100644--- a/tooling/mobile-updates.test.ts+++ b/tooling/mobile-updates.test.ts@@ -2,52 +2,48 @@ import { spawnSync } from "node:child_process";import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";import { tmpdir } from "node:os";import { join } from "node:path";+import { runInNewContext } from "node:vm";import { expect, it } from "vite-plus/test";const workflow = readFileSync(new URL("../.github/workflows/docker-build.yml", import.meta.url), "utf8");+const otaWorkflow = readFileSync(new URL("../.github/workflows/mobile-ota-update.yml", import.meta.url), "utf8");const commit = "a".repeat(40);-it("publishes production only after stable deployment, and skips superseded main previews", () => {- const script = workflow.match(- / - name: Select mobile update channel[\s\S]*? run: \|\n([\s\S]*?)\n mobile-update:/,- )?.[1];- if (!script) throw new Error("Mobile channel selection script is missing");- const directory = mkdtempSync(join(tmpdir(), "mobile-channel-"));- try {- writeFileSync(join(directory, "git"), `#!/usr/bin/env bash\nprintf '%s\\trefs/heads/main\\n' "$MAIN_SHA"\n`, {- mode: 0o755,- });- for (const [release, prerelease, deployed, nightly, main, expected] of [- ["true", "false", "success", "false", commit, "production"],- ["true", "false", "skipped", "false", commit, ""],- ["true", "false", "failure", "false", commit, ""],- ["true", "true", "skipped", "false", commit, "preview"],- ["false", "false", "skipped", "true", commit, "preview"],- ["false", "false", "skipped", "true", "b".repeat(40), ""],- ["false", "false", "skipped", "false", "b".repeat(40), "preview"],- ]) {- const output = join(directory, "output");- writeFileSync(output, "");- const result = spawnSync("bash", ["-eu", "-c", script], {- encoding: "utf8",- env: {- ...process.env,- PATH: `${directory}:${process.env.PATH}`,- RELEASE: release,- PRERELEASE: prerelease,- DEPLOYED: deployed,- NIGHTLY: nightly,- COMMIT_SHA: commit,- MAIN_SHA: main,- GITHUB_OUTPUT: output,- },- });- expect(result.status, result.stderr).toBe(0);- expect(readFileSync(output, "utf8")).toBe(expected ? `channel=${expected}\n` : "");- }- } finally {- rmSync(directory, { recursive: true, force: true });- }+it.each([+ ["stable release", "true", "false", "success", true],+ ["nightly or canary", "false", "false", "skipped", false],+ ["prerelease", "true", "true", "skipped", false],+ ["missing deployment", "true", "false", "skipped", false],+ ["failed deployment", "true", "false", "failure", false],+] as const)(+ "allows production OTA only after stable deployment: %s",+ (_name, release, prerelease, deployed, expected) => {+ const expression = workflow.match(/mobile_ota: \$\{\{ (.+) \}\}/)?.[1];+ if (!expression) throw new Error("Mobile OTA eligibility output is missing");+ expect(+ runInNewContext(expression, {+ needs: { mode: { outputs: { release } } },+ steps: { version: { outputs: { prerelease } }, deploy: { outcome: deployed } },+ }),+ ).toBe(expected);+ },+);++it.each([+ ["success", "true", false, true],+ ["success", "false", false, false],+ ["failure", "true", false, false],+ ["skipped", "true", false, false],+ ["success", "true", true, false],+] as const)("gates OTA on Docker result=%s, eligible=%s, cancelled=%s", (result, mobile_ota, cancelled, expected) => {+ const expression = workflow.match(/ mobile-ota-update:\n[\s\S]*? if: \$\{\{ (.+) \}\}/)?.[1];+ if (!expression) throw new Error("Mobile OTA caller condition is missing");+ expect(+ runInNewContext(expression, {+ cancelled: () => cancelled,+ needs: { merge: { result, outputs: { mobile_ota } } },+ }),+ ).toBe(expected);});const healthy = { service: "reactive-resume", status: "healthy", revision: commit };@@ -76,7 +72,7 @@ it.each([12,],] as const)("requires three consecutive matching production probes: %s", (_name, responses, status, probes) => {- const script = workflow.match(+ const script = otaWorkflow.match(/ - name: Wait for matching production backend[\s\S]*? run: \|\n([\s\S]*?)(?=\n - name:)/,)?.[1];if (!script) throw new Error("Production backend check is missing");