diff --git a/.github/workflows/release-android.yml b/.github/workflows/release-android.yml index e1fd068..5443349 100644 --- a/.github/workflows/release-android.yml +++ b/.github/workflows/release-android.yml @@ -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 @@ -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 \ @@ -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: @@ -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 diff --git a/app.prod.json b/app.prod.json index 984aa5e..f0184d4 100644 --- a/app.prod.json +++ b/app.prod.json @@ -26,6 +26,7 @@ }, "predictiveBackGestureEnabled": false, "package": "org.missingmaps.mapswipe", + "versionCode": 3000100, "userInterfaceStyle": "light" }, "web": { diff --git a/app.staging.json b/app.staging.json index 7b2fa0a..3ee890a 100644 --- a/app.staging.json +++ b/app.staging.json @@ -26,6 +26,7 @@ }, "predictiveBackGestureEnabled": false, "package": "org.missingmaps.mapswipe.dev", + "versionCode": 3000100, "userInterfaceStyle": "light" }, "web": { diff --git a/deploy.sh b/deploy.sh index be8fc40..f752d61 100755 --- a/deploy.sh +++ b/deploy.sh @@ -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 @@ -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 @@ -187,6 +195,9 @@ 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" @@ -194,6 +205,7 @@ printf '%s│%s mode %s%s%s\n' "$CYAN" "$RESET" "$BOLD 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" @@ -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"