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
30 changes: 13 additions & 17 deletions .github/workflows/release-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ jobs:

# ─── JOB 2: PRODUCTION BUILD (requires manual approval) ─────────────
build-production:
name: Build and Deploy Production AAB
name: Build and Deploy Production APK
environment: production
runs-on: ubuntu-latest
needs: build-staging
Expand Down Expand Up @@ -221,18 +221,15 @@ jobs:
sudo rm -rf /usr/share/dotnet /usr/local/share/powershell /usr/share/swift /opt/ghc /opt/hostedtoolcache/CodeQL
df -h

- name: Build production AAB
- name: Build production APK
env:
KEYSTORE_PATH: ${{ runner.temp }}/mapswipe-prod.keystore
STORE_PASSWORD: ${{ secrets.ANDROID_PRODUCTION_KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.ANDROID_PRODUCTION_KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.ANDROID_PRODUCTION_KEY_PASSWORD }}
# bundleRelease produces an Android App Bundle for the Play Store. No
# -PreactNativeArchitectures override, so all ABIs are included and Play
# splits per device. The prod keystore signs it as the upload key; Play
# App Signing re-signs the delivered APKs.
run: |
cd android && ./gradlew bundleRelease --stacktrace \
cd android && ./gradlew assembleRelease --stacktrace \
-PreactNativeArchitectures=armeabi-v7a,arm64-v8a \
-Pandroid.injected.signing.store.file=$KEYSTORE_PATH \
-Pandroid.injected.signing.store.password=$STORE_PASSWORD \
-Pandroid.injected.signing.key.alias=$KEY_ALIAS \
Expand All @@ -247,11 +244,11 @@ jobs:
echo "tag=dev-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
fi

- name: Rename AAB
- name: Rename APK
run: |
mkdir -p generated
cp android/app/build/outputs/bundle/release/app-release.aab \
generated/mapswipe-${{ steps.tag.outputs.tag }}.aab
cp android/app/build/outputs/apk/release/app-release.apk \
generated/mapswipe-${{ steps.tag.outputs.tag }}.apk

- name: Publish production release
env:
Expand All @@ -261,15 +258,14 @@ jobs:
--title "MapSwipe Mobile ${{ steps.tag.outputs.tag }}" \
--notes "## MapSwipe Mobile ${{ steps.tag.outputs.tag }}

### 🚀 Play Store release
1. Download the AAB below
2. Upload it to the Play Console production track (Google re-signs it via Play App Signing)
3. Review and roll out the release
### 📱 Install
1. Download the APK below
2. Enable 'Install from unknown sources' in Android settings
3. Install

### 🔧 Build info
- Commit: \`${{ github.sha }}\`
- Build: #${{ github.run_number }}
- Date: $(date +'%Y-%m-%d %H:%M:%S UTC')
- Package: \`org.missingmaps.mapswipe\`
- Artifact: Android App Bundle (.aab), signed with the upload key" \
generated/mapswipe-${{ steps.tag.outputs.tag }}.aab
- Package: \`org.missingmaps.mapswipe\`" \
generated/mapswipe-${{ steps.tag.outputs.tag }}.apk
1 change: 1 addition & 0 deletions app.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"predictiveBackGestureEnabled": false,
"package": "org.missingmaps.mapswipe",
"versionCode": 3000100,
"userInterfaceStyle": "light"
},
"web": {
Expand Down
1 change: 1 addition & 0 deletions app.staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"predictiveBackGestureEnabled": false,
"package": "org.missingmaps.mapswipe.dev",
"versionCode": 3000100,
"userInterfaceStyle": "light"
},
"web": {
Expand Down
17 changes: 17 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ REMOTE="origin"
DEVELOP_BRANCH="develop"
VERSION_FILES=(package.json app.prod.json app.staging.json)
BUILDNUMBER_FILES=(app.prod.json app.staging.json)
VERSIONCODE_FILES=(app.prod.json app.staging.json) # android.versionCode, derived from version+build

# ── Pretty output ───────────────────────────────────────────────────────
if [[ -t 1 ]]; then
Expand Down Expand Up @@ -154,6 +155,13 @@ read -rp "$(printf '%sNew build number%s [current: %s]: ' "$BOLD" "$RESET" "$cur
[[ "$new_build" =~ ^[0-9]+$ ]] \
|| die "Build number must be a non-negative integer (got '$new_build')."

# Android versionCode: one monotonic integer derived from version + build, using
# the legacy MapSwipe scheme (major*1000000 + minor*10000 + patch*100 + build).
# The 1e6 scale keeps 3.x codes above the old 2.x app already live on Play.
# Assumes minor, patch and build each stay < 100 (10# forces base-10 on zeros).
IFS=. read -r vc_major vc_minor vc_patch <<< "$new_version"
new_version_code=$(( 10#$vc_major * 1000000 + 10#$vc_minor * 10000 + 10#$vc_patch * 100 + 10#$new_build ))

read -rp "$(printf '%sOne-line release description:%s ' "$BOLD" "$RESET")" description
description="${description#"${description%%[![:space:]]*}"}" # ltrim
description="${description%"${description##*[![:space:]]}"}" # rtrim
Expand Down Expand Up @@ -187,13 +195,17 @@ fi
if [[ "$mode" == "test" && "$new_version" != "$current_version" ]]; then
warnings+=("Test release changes the version. This lands on '$DEVELOP_BRANCH' (directly, or via merge) — version bumps belong to production releases.")
fi
if (( 10#$vc_minor >= 100 || 10#$vc_patch >= 100 || 10#$new_build >= 100 )); then
warnings+=("versionCode formula assumes minor/patch/build < 100; a component is ≥ 100, so the derived code ($new_version_code) may collide with a neighbouring version. Revisit the scheme.")
fi

# ── 7. Summary + confirm ─────────────────────────────────────────────────
printf '\n%s%s┌─ Release summary ─────────────────────────────────┐%s\n' "$BOLD" "$CYAN" "$RESET"
printf '%s│%s mode %s%s%s\n' "$CYAN" "$RESET" "$BOLD" "$mode" "$RESET"
printf '%s│%s branch %s\n' "$CYAN" "$RESET" "$current_branch"
printf '%s│%s version %s → %s%s%s\n' "$CYAN" "$RESET" "$current_version" "$BOLD" "$new_version" "$RESET"
printf '%s│%s buildNumber %s → %s%s%s\n' "$CYAN" "$RESET" "$current_build" "$BOLD" "$new_build" "$RESET"
printf '%s│%s versionCode %s%s%s %s(android, derived)%s\n' "$CYAN" "$RESET" "$BOLD" "$new_version_code" "$RESET" "$DIM" "$RESET"
printf '%s│%s commit %s%s%s\n' "$CYAN" "$RESET" "$DIM" "$commit_subject" "$RESET"
printf '%s│%s tag %s%s%s (annotated)\n' "$CYAN" "$RESET" "$BOLD" "$tag" "$RESET"
printf '%s│%s push %s → %s\n' "$CYAN" "$RESET" "$push_target" "$REMOTE"
Expand Down Expand Up @@ -225,6 +237,11 @@ for f in "${BUILDNUMBER_FILES[@]}"; do
perl -i -pe 's/("buildNumber"\s*:\s*")[^"]*(")/${1}'"$new_build"'${2}/' "$f"
done

info "Setting android.versionCode to $new_version_code…"
for f in "${VERSIONCODE_FILES[@]}"; do
perl -i -pe 's/("versionCode"\s*:\s*)[0-9]+/${1}'"$new_version_code"'/' "$f"
done

info "Committing…"
git add "${VERSION_FILES[@]}"
git commit --quiet -m "$commit_subject"
Expand Down
Loading