Skip to content

Commit 974878d

Browse files
authored
ci: fix the release cache failure and document shipping on publish (#73)
- setup-node resolved the pnpm store from the repo root (pnpm 8 via the root packageManager) while mobile/ installs with pnpm 10, so the post step's cache save failed build-and-test-tracks after the builds were done and skipped every later job. The release workflow no longer caches dependencies (package-manager-cache: false, no cache input), so no post step has anything to save. - app-stores has no required reviewers any more: summaries and RELEASING.md say publishing ships, and that the environment only limits the production jobs to main / mobile-v* tags. - RELEASING.md: "If a run fails after the builds" shows how to finish by hand with eas build:list, play.mjs internal|production and appstore.mjs submit. The build job's failure summary points there.
1 parent bec1c7d commit 974878d

3 files changed

Lines changed: 96 additions & 21 deletions

File tree

‎.github/workflows/mobile-release.yml‎

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
# if another app release run is still going.
66
# 2. build-and-test-tracks: EAS builds both apps and sends iOS to TestFlight.
77
# android-internal: sends Android to Play internal testing.
8-
# 3. production-ios / production-android: wait for approval of the `app-stores` environment,
9-
# then submit iOS for App Review and release Android to everyone on Google Play.
8+
# 3. production-ios / production-android: submit iOS for App Review and release Android to
9+
# everyone on Google Play. There is no approval step: publishing the release ships it. The
10+
# `app-stores` environment only restricts these jobs to main and mobile-v* tags.
1011
#
1112
# Only one app release runs at a time. There is deliberately no workflow-level concurrency group:
1213
# GitHub keeps one pending run per group and silently cancels the older one, so instead
@@ -68,10 +69,10 @@ jobs:
6869
if [ -n "$others" ]; then
6970
{
7071
echo "## Not started: another app release is still running"
71-
echo "Finish it (approve or reject its \`app-stores\` deployment) or cancel it, then run **Mobile release** by hand with tag \`$TAG\`."
72+
echo "Let it finish or cancel it, then run **Mobile release** by hand with tag \`$TAG\`."
7273
echo "$others"
7374
} >> "$GITHUB_STEP_SUMMARY"
74-
echo "::error::Another Mobile release run is still running or waiting for approval. See the summary; then re-run with tag $TAG."
75+
echo "::error::Another Mobile release run is still running. See the summary; then re-run with tag $TAG."
7576
exit 1
7677
fi
7778
@@ -84,6 +85,10 @@ jobs:
8485
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
8586
with:
8687
node-version: 22
88+
# No dependency cache: these runs are rare, and setup-node resolved the pnpm store from
89+
# the repo root (pnpm 8) while mobile/ installs with pnpm 10, so its post-step cache
90+
# save failed the job after the builds had finished.
91+
package-manager-cache: false
8792

8893
- name: Version from tag
8994
id: version
@@ -147,8 +152,10 @@ jobs:
147152
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
148153
with:
149154
node-version: 22
150-
cache: pnpm
151-
cache-dependency-path: mobile/pnpm-lock.yaml
155+
# No dependency cache: these runs are rare, and setup-node resolved the pnpm store from
156+
# the repo root (pnpm 8) while mobile/ installs with pnpm 10, so its post-step cache
157+
# save failed the job after the builds had finished.
158+
package-manager-cache: false
152159

153160
- uses: expo/expo-github-action@5273c2136bd09c2a341fe3340d3e767ce5a13015 # 9.0.2
154161
with:
@@ -245,7 +252,11 @@ jobs:
245252
echo "- Setting TestFlight's \"What to Test\" didn't finish; the build is still there. Set it in App Store Connect if you want."
246253
fi
247254
else
248-
echo "The build or the TestFlight upload failed. Check the failed step, fix it, then re-run this job (it builds again)."
255+
if [ -n "$IOS_BUILD_NUMBER" ]; then
256+
echo "Something failed after the EAS builds finished (iOS build $IOS_BUILD_NUMBER). Re-running this job builds again; to reuse these builds instead, finish by hand as described in \"If a run fails after the builds\" in mobile/RELEASING.md."
257+
else
258+
echo "The EAS build failed. Check the failed step, fix it, then re-run this job."
259+
fi
249260
fi
250261
} >> "$GITHUB_STEP_SUMMARY"
251262
@@ -271,6 +282,10 @@ jobs:
271282
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
272283
with:
273284
node-version: 22
285+
# No dependency cache: these runs are rare, and setup-node resolved the pnpm store from
286+
# the repo root (pnpm 8) while mobile/ installs with pnpm 10, so its post-step cache
287+
# save failed the job after the builds had finished.
288+
package-manager-cache: false
274289

275290
- name: Upload Android to Play internal testing
276291
id: play
@@ -294,7 +309,7 @@ jobs:
294309
if [ "$JOB_STATUS" = success ]; then
295310
echo "- Android $VERSION ($VERSION_CODE) is on Play internal testing."
296311
echo
297-
echo "**Next:** test the TestFlight and internal testing builds, then approve the \`app-stores\` deployment on this run to submit to the stores."
312+
echo "**Next:** the production jobs submit iOS for App Review and release Android to everyone; no action needed."
298313
else
299314
echo "The upload to Play failed. Check the step, fix it, then re-run this job."
300315
fi
@@ -319,6 +334,10 @@ jobs:
319334
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
320335
with:
321336
node-version: 22
337+
# No dependency cache: these runs are rare, and setup-node resolved the pnpm store from
338+
# the repo root (pnpm 8) while mobile/ installs with pnpm 10, so its post-step cache
339+
# save failed the job after the builds had finished.
340+
package-manager-cache: false
322341

323342
- name: Submit iOS for App Review
324343
env:
@@ -366,6 +385,10 @@ jobs:
366385
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
367386
with:
368387
node-version: 22
388+
# No dependency cache: these runs are rare, and setup-node resolved the pnpm store from
389+
# the repo root (pnpm 8) while mobile/ installs with pnpm 10, so its post-step cache
390+
# save failed the job after the builds had finished.
391+
package-manager-cache: false
369392

370393
- name: Release Android to everyone on Google Play
371394
env:

‎mobile/RELEASING.md‎

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,37 +75,73 @@ The server and web app still deploy on every merge.
7575
"What's new", so keep it to plain sentences, at most 500 characters (Google Play's limit). The
7676
HTML comment at the end only tracks the included PRs and is removed. For a minor or major
7777
version, change the tag (e.g. `mobile-v1.1.0`) and the title.
78-
4. **Publish the release.** The _Mobile release_ workflow builds both apps on EAS with that version,
79-
then puts them on TestFlight and Play internal testing with the notes.
80-
5. **Test** the TestFlight and internal testing builds.
81-
6. **Approve the `app-stores` deployment** on the workflow run. iOS is submitted for App Review and
82-
releases automatically once approved. Android is released to everyone on Google Play and
83-
reaches users once Google's review finishes. There are no staged rollouts: the test tracks and
84-
your approval are the check.
85-
7. **Watch** App Review and Play Console. If an Android release turns out badly broken, halt it in
78+
4. **Test before you publish.** Publishing ships: there is no approval step after it. Check the
79+
changes on `main` first, e.g. with a `preview` build or a local run.
80+
5. **Publish the release.** The _Mobile release_ workflow builds both apps on EAS with that version,
81+
puts them on TestFlight and Play internal testing with the notes, then submits iOS for App
82+
Review (released automatically once Apple approves) and releases Android to everyone on Google
83+
Play (live once Google's review finishes). There are no staged rollouts.
84+
6. **Watch** App Review and Play Console. If an Android release turns out badly broken, halt it in
8685
Play Console (Test and release > Production), fix the problem and ship a new release.
8786

8887
If a job fails, its summary says what happened. Fix the cause and re-run the failed job, or run
8988
_Mobile release_ by hand with the tag. Re-running a production job is safe: iOS resumes an unsent
9089
review submission and stops if the version was already sent; Android leaves a release that is
9190
already on production alone.
9291

93-
Only one app release runs at a time. Publishing another while one is still running or waiting
94-
for approval fails at once and links the run in the way; finish or cancel that run, then run
92+
Only one app release runs at a time. Publishing another while one is still running fails at once
93+
and links the run in the way; finish or cancel that run, then run
9594
_Mobile release_ by hand with the new tag. The two jobs that write to Google Play (the internal
9695
upload and the production release) run one at a time, because Play allows one open edit per app.
9796

97+
### If a run fails after the builds
98+
99+
Re-running _Build and test tracks_ builds again with new build numbers. To ship the builds that
100+
already finished instead, do the remaining steps by hand from the repo root. Skip what the run
101+
already did; its job summaries say what that was.
102+
103+
```sh
104+
# The notes, exactly as the workflow sends them.
105+
gh release view mobile-v<version> --json body --jq .body > /tmp/body.md
106+
node mobile/scripts/release/prepare-notes.mjs /tmp/body.md /tmp/notes.txt
107+
108+
# The finished builds for that version. appBuildVersion is the iOS build number / Android
109+
# versionCode; artifacts.buildUrl is the file. Run from mobile/.
110+
npx eas-cli@latest build:list --build-profile production --status finished \
111+
--app-version <version> --limit 2 --json
112+
113+
# iOS, if the build isn't on TestFlight yet (EAS uses its stored ASC key, or EXPO_ASC_API_KEY_PATH,
114+
# EXPO_ASC_KEY_ID and EXPO_ASC_ISSUER_ID). Run from mobile/.
115+
npx eas-cli@latest submit -p ios --id <iOS EAS build id> --profile production --non-interactive
116+
117+
# Android. Needs PLAY_SERVICE_ACCOUNT_JSON (the key file's contents). Skip `internal` if that
118+
# versionCode is already uploaded; Play rejects the same versionCode twice.
119+
curl -fsSL "<Android buildUrl>" -o /tmp/app.aab
120+
node mobile/scripts/release/play.mjs internal --aab /tmp/app.aab --version <version> \
121+
--notes-file /tmp/notes.txt
122+
node mobile/scripts/release/play.mjs production --version <version> \
123+
--version-code <versionCode> --notes-file /tmp/notes.txt
124+
125+
# iOS App Review. Needs ASC_KEY_ID, ASC_ISSUER_ID and ASC_API_KEY_P8 (the .p8 file's contents).
126+
node mobile/scripts/release/appstore.mjs submit --version <version> \
127+
--build-number <build number> --notes-file /tmp/notes.txt
128+
```
129+
130+
Add `--dry-run` to any `play.mjs` / `appstore.mjs` command to see the requests first. All of them
131+
are safe to repeat: `production` leaves a release that's already there alone, and `submit`
132+
resumes or skips a submission.
133+
98134
The scripts the workflows use live in `mobile/scripts/release/` and run with plain Node (no
99135
install). Add `--dry-run` to print the API requests without sending them. Their tests run with
100136
`node --test mobile/scripts/release/release.test.mjs`.
101137

102138
### Setup for the workflows
103139

104140
- Label `mobile` on the repo.
105-
- Environment `app-stores` with the owner as required reviewer, limited to the `main` branch and
106-
tags `mobile-v*`. It gates only the production jobs.
141+
- Environment `app-stores`, used by the production jobs. It has no required reviewers; it only
142+
restricts those jobs to the `main` branch and `mobile-v*` tags.
107143
- **Repository** secrets (not environment secrets: the build and test-track jobs don't use the
108-
`app-stores` environment, so they can't see its secrets):
144+
`app-stores` environment, so they couldn't see its secrets):
109145
- `EXPO_TOKEN`: an Expo access token for `koushikdotdev`;
110146
- `ASC_KEY_ID`, `ASC_ISSUER_ID`, `ASC_API_KEY_P8` (the `.p8` file's contents): an App Store
111147
Connect API key with the App Manager role;

‎mobile/scripts/release/release.test.mjs‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,22 @@ describe('mobile-release.yml', () => {
649649
);
650650
});
651651

652+
it('should not cache dependencies, so no post-step can fail the job', () => {
653+
const setups = workflow.split('uses: actions/setup-node@').slice(1);
654+
assert.ok(setups.length >= 5);
655+
setups.forEach((setup) => {
656+
const block = setup.split('\n - ')[0];
657+
assert.match(block, /package-manager-cache: false/);
658+
assert.doesNotMatch(block, /^\s+cache:/m);
659+
});
660+
assert.doesNotMatch(workflow, /cache-dependency-path/);
661+
});
662+
663+
it('should ship on publish, with no approval step', () => {
664+
assert.doesNotMatch(workflow, /approve the|waiting for approval|approve or reject/i);
665+
assert.match(workflow, /There is no approval step/);
666+
});
667+
652668
it('should take the version from the tag and reject other tags', () => {
653669
assert.match(workflow, /versionFromTag\(process\.env\.TAG\)/);
654670
assert.match(workflow, /\^mobile-v\[0-9\]\+/);

0 commit comments

Comments
 (0)