feat: Build and release per-architecture APKs (#550)

* feat: Build and release per-architecture APKs

This commit modifies the build process to generate separate APKs for different CPU architectures (arm64-v8a, x86_64) and a universal APK. This allows for smaller, optimized downloads for users and provides specific builds for platforms like Chromebooks.

Key changes:
- In `app/build.gradle.kts`, enables ABI splits to create `arm64-v8a`, `x86_64`, and `universal` APKs during the `assembleRelease` task.
- Updates the `release.yml` GitHub Actions workflow to rename and upload each of these APKs as distinct release assets.
- Removes the previous `arm64-v8a` only filter to allow for multi-architecture builds.

* feat: Allow manual triggering of Android CI workflow

This adds the `workflow_dispatch` event to the `android-build.yml` GitHub Actions workflow.

This change enables the Android CI pipeline to be run manually from the GitHub UI, in addition to the existing triggers for pushes and pull requests.
This commit is contained in:
Moe Hamade
2026-01-05 17:28:53 +07:00
committed by GitHub
parent eef831fe60
commit 68407e3b47
3 changed files with 32 additions and 23 deletions
+1
View File
@@ -1,6 +1,7 @@
name: Android CI name: Android CI
on: on:
workflow_dispatch:
push: push:
branches: [ "main", "develop" ] branches: [ "main", "develop" ]
pull_request: pull_request:
+19 -18
View File
@@ -38,17 +38,20 @@ jobs:
- name: Grant execute permission for Gradlew - name: Grant execute permission for Gradlew
run: chmod +x ./gradlew run: chmod +x ./gradlew
- name: Build Release APK (with Tor) - name: Build Release APKs (with architecture splits)
run: ./gradlew assembleRelease --no-daemon --stacktrace run: ./gradlew assembleRelease --no-daemon --stacktrace
- name: List APK files - name: List APK files
run: | run: |
echo "APK files built:" echo "APK files built:"
find app/build/outputs/apk -name "*.apk" -type f find app/build/outputs/apk/release -name "*.apk" -type f -exec ls -lh {} \;
- name: Rename APK - name: Rename APKs for GitHub Release
run: | run: |
mv app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/bitchat-android.apk cd app/build/outputs/apk/release
[ -f "app-arm64-v8a-release-unsigned.apk" ] && mv app-arm64-v8a-release-unsigned.apk bitchat-android-arm64.apk
[ -f "app-x86_64-release-unsigned.apk" ] && mv app-x86_64-release-unsigned.apk bitchat-android-x86_64.apk
[ -f "app-universal-release-unsigned.apk" ] && mv app-universal-release-unsigned.apk bitchat-android-universal.apk
- name: DEBUG - name: DEBUG
run: | run: |
@@ -59,8 +62,8 @@ jobs:
ls -all ls -all
tree || ls -R tree || ls -R
# Optional: Sign APK (requires secrets) # Optional: Sign APKs (uncomment and configure secrets when ready)
# - name: Sign APK # - name: Sign APKs
# uses: r0adkll/sign-android-release@v1 # uses: r0adkll/sign-android-release@v1
# with: # with:
# releaseDirectory: app/build/outputs/apk/release # releaseDirectory: app/build/outputs/apk/release
@@ -69,10 +72,10 @@ jobs:
# keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} # keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
# keyPassword: ${{ secrets.KEY_PASSWORD }} # keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Upload APK as artifact - name: Upload APKs as artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: bitchat-android-apk-${{ github.ref_name }} name: bitchat-android-release-${{ github.ref_name }}
path: app/build/outputs/apk/release/*.apk path: app/build/outputs/apk/release/*.apk
retention-days: 30 retention-days: 30
if-no-files-found: error if-no-files-found: error
@@ -82,25 +85,23 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Download APK artifact - name: Download release artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: bitchat-android-apk-${{ github.ref_name }} name: bitchat-android-release-${{ github.ref_name }}
path: release path: release
- name: Create GitHub Release - name: Create GitHub Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
files: | files: |
release/bitchat-android.apk release/bitchat-android-arm64.apk
release/bitchat-android-x86_64.apk
release/bitchat-android-universal.apk
name: Release ${{ github.ref_name }} name: Release ${{ github.ref_name }}
body: | body: |
## bitchat Android Release **bitchat-android-arm64.apk** - ARM64 (most phones)
**bitchat-android-x86_64.apk** - x86_64 (Chromebooks, tablets)
**bitchat-android.apk** (~15MB) **bitchat-android-universal.apk** - All architectures (fallback)
- Secure P2P messaging over Bluetooth mesh and Nostr
- Built-in Tor support (custom Arti build with 16KB page size)
- Compatible with Google Play requirements (Nov 2025+)
- Cross-platform compatible with iOS version
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+12 -5
View File
@@ -43,13 +43,20 @@ android {
getDefaultProguardFile("proguard-android-optimize.txt"), getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro" "proguard-rules.pro"
) )
ndk {
// ARM64-only to minimize APK size (~5.8MB savings)
// Excludes x86_64 as emulator not needed for production builds
abiFilters += listOf("arm64-v8a")
}
} }
} }
// APK splits for GitHub releases - creates arm64, x86_64, and universal APKs
// AAB for Play Store handles architecture distribution automatically
splits {
abi {
isEnable = true
reset()
include("arm64-v8a", "x86_64")
isUniversalApk = true // For F-Droid and fallback
}
}
compileOptions { compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8