Skip to content

Mobile: create dividers in a tag list (web parity) #33

Mobile: create dividers in a tag list (web parity)

Mobile: create dividers in a tag list (web parity) #33

name: Android Release
# Builds the Expo Android app bundle and publishes it to the Play "alpha"
# (closed testing) track — the track notes.world's testers are already on.
# Runs when the mobile app changes on master, or on demand.
# Signing is self-contained in the repo (packages/mobile/android keystore), so
# only the Play service-account JSON is needed as a secret.
on:
push:
branches: [master]
paths:
- "packages/mobile/**"
- "!packages/mobile/**.md"
- ".github/workflows/android-release.yml"
workflow_dispatch:
concurrency:
group: android-release
cancel-in-progress: false
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Skip until Play service account is configured
id: guard
run: |
if [ -z "${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}" ]; then
echo "PLAY_SERVICE_ACCOUNT_JSON secret is not set — skipping Play publish."
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- uses: actions/checkout@v6
if: steps.guard.outputs.skip != 'true'
- uses: actions/setup-node@v6
if: steps.guard.outputs.skip != 'true'
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
if: steps.guard.outputs.skip != 'true'
run: npm ci
- uses: actions/setup-java@v5
if: steps.guard.outputs.skip != 'true'
with:
distribution: temurin
java-version: 17
cache: gradle
- uses: android-actions/setup-android@v4
if: steps.guard.outputs.skip != 'true'
- name: Compute versionCode (run number + offset; must be monotonic)
if: steps.guard.outputs.skip != 'true'
run: echo "VERSION_CODE=$(( ${{ github.run_number }} + 10 ))" >> "$GITHUB_ENV"
- name: Inject versionCode + auto-incrementing versionName into build.gradle
if: steps.guard.outputs.skip != 'true'
run: |
# versionName tracks the monotonic versionCode (e.g. 0.1.19, 0.1.20)
# so every build has a distinct, increasing version visible in the
# Play Store and Android app info.
sed -i -E "s/versionCode [0-9]+/versionCode ${VERSION_CODE}/" \
packages/mobile/android/app/build.gradle
sed -i -E "s/versionName \"[^\"]*\"/versionName \"0.1.${VERSION_CODE}\"/" \
packages/mobile/android/app/build.gradle
grep -nE 'versionCode|versionName' packages/mobile/android/app/build.gradle
- name: Build release AAB
if: steps.guard.outputs.skip != 'true'
working-directory: packages/mobile/android
env:
NODE_ENV: production
run: ./gradlew :app:bundleRelease --no-daemon --stacktrace
- name: Write Play service-account JSON
if: steps.guard.outputs.skip != 'true'
env:
PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}
run: printf '%s' "$PLAY_SERVICE_ACCOUNT_JSON" > "$RUNNER_TEMP/play-sa.json"
- name: Upload AAB to Play (alpha / closed testing)
if: steps.guard.outputs.skip != 'true'
env:
PLAY_SERVICE_ACCOUNT_FILE: ${{ runner.temp }}/play-sa.json
run: |
pip install --quiet google-api-python-client google-auth
python scripts/play_upload.py \
packages/mobile/android/app/build/outputs/bundle/release/app-release.aab \
notes.world \
alpha