Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .claude/skills/android-generate/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,30 @@ description: Build the Android APK for the mobile app by running npm run android

Runs the project's existing Android APK release command.

The APK bakes in `EXPO_PUBLIC_API_BASE` at prebuild time, so the API the build targets is decided by the environment present when the script runs. Default (no env set) builds against prod (`https://api.useorbit.org`).

## Steps

### Prod (default)

1. From the repo root, run `npm run android:apk -w @orbit/mobile`. The `android:apk` script is defined in the `apps/mobile` workspace (`node scripts/android-release-apk.js`), not at the root, so it must be targeted with `-w @orbit/mobile`.

### QA

Build against the QA API instead of prod by exporting the QA base (and forcing AdMob test IDs so the QA build never serves live ads) before running the same command. The QA API base is the public QA endpoint `https://api-qa.useorbit.org`.

- PowerShell:

```powershell
$env:EXPO_PUBLIC_API_BASE = "https://api-qa.useorbit.org"
$env:EXPO_PUBLIC_ADMOB_USE_TEST_IDS = "true"
npm run android:apk -w @orbit/mobile
```

- bash:

```bash
EXPO_PUBLIC_API_BASE="https://api-qa.useorbit.org" \
EXPO_PUBLIC_ADMOB_USE_TEST_IDS="true" \
npm run android:apk -w @orbit/mobile
```
37 changes: 37 additions & 0 deletions .github/workflows/android-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,33 @@ jobs:
${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
EOF

- name: Resolve build target (prod vs QA)
shell: bash
env:
RELEASE_TRACK: ${{ inputs.track }}
QA_API_BASE: ${{ vars.QA_API_BASE }}
PROD_API_BASE: https://api.useorbit.org
run: |
set -euo pipefail

if [ "${RELEASE_TRACK}" = "internal" ]; then
if [ -z "${QA_API_BASE}" ]; then
echo "::error::The internal track builds against QA, but vars.QA_API_BASE is not set. Configure it under repo Settings → Secrets and variables → Actions → Variables." >&2
exit 1
fi
echo "BUILD_API_BASE=${QA_API_BASE}" >> "${GITHUB_ENV}"
echo "BUILD_ADMOB_USE_TEST_IDS=true" >> "${GITHUB_ENV}"
echo "BUILD_EAS_PROFILE=qa" >> "${GITHUB_ENV}"
echo "Build target: QA (api_base=${QA_API_BASE}, test AdMob IDs)"
else
echo "BUILD_API_BASE=${PROD_API_BASE}" >> "${GITHUB_ENV}"
echo "BUILD_ADMOB_USE_TEST_IDS=false" >> "${GITHUB_ENV}"
echo "BUILD_EAS_PROFILE=production" >> "${GITHUB_ENV}"
echo "Build target: PROD (api_base=${PROD_API_BASE}, real AdMob IDs)"
fi

- name: Validate Expo config resolves production AdMob IDs
if: ${{ inputs.track != 'internal' }}
working-directory: ${{ env.RELEASE_WORKDIR }}/apps/mobile
shell: bash
env:
Expand All @@ -204,12 +230,19 @@ jobs:
env:
CI: "1"
EXPO_NO_TELEMETRY: "1"
EAS_BUILD_PROFILE: ${{ env.BUILD_EAS_PROFILE }}
EXPO_PUBLIC_API_BASE: ${{ env.BUILD_API_BASE }}
EXPO_PUBLIC_ADMOB_USE_TEST_IDS: ${{ env.BUILD_ADMOB_USE_TEST_IDS }}
run: |
set -euo pipefail

echo "Prebuild API base: ${EXPO_PUBLIC_API_BASE}"
echo "Prebuild AdMob test IDs: ${EXPO_PUBLIC_ADMOB_USE_TEST_IDS}"

npx expo prebuild --platform android --no-install

- name: Validate generated Android project does not contain sample AdMob IDs
if: ${{ inputs.track != 'internal' }}
working-directory: ${{ env.RELEASE_WORKDIR }}/apps/mobile
shell: bash
run: |
Expand Down Expand Up @@ -259,6 +292,9 @@ jobs:
shell: bash
env:
CLEAR_CACHE: ${{ inputs.clear_cache }}
EAS_BUILD_PROFILE: ${{ env.BUILD_EAS_PROFILE }}
EXPO_PUBLIC_API_BASE: ${{ env.BUILD_API_BASE }}
EXPO_PUBLIC_ADMOB_USE_TEST_IDS: ${{ env.BUILD_ADMOB_USE_TEST_IDS }}
run: |
set -euo pipefail

Expand All @@ -271,6 +307,7 @@ jobs:
./gradlew --no-daemon bundleRelease

- name: Verify shipped AAB embeds production AdMob IDs
if: ${{ inputs.track != 'internal' }}
working-directory: ${{ env.RELEASE_WORKDIR }}/apps/mobile
shell: bash
run: |
Expand Down
17 changes: 17 additions & 0 deletions apps/mobile/eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
"EXPO_PUBLIC_ADMOB_USE_TEST_IDS": "true"
}
},
"qa": {
"distribution": "internal",
"android": {
"buildType": "apk"
},
"env": {
"EXPO_PUBLIC_API_BASE": "https://api-qa.useorbit.org",
"EXPO_PUBLIC_ADMOB_USE_TEST_IDS": "true"
}
},
"production": {
"distribution": "store",
"android": {
Expand All @@ -47,6 +57,13 @@
"releaseStatus": "completed"
}
},
"qa": {
"android": {
"serviceAccountKeyPath": "./play-service-account.json",
"track": "internal",
"releaseStatus": "completed"
}
},
"closed": {
"android": {
"serviceAccountKeyPath": "./play-service-account.json",
Expand Down
Loading