feat: enhance Android APK build process with per-ABI splits and universal APK support

This commit is contained in:
Sarto
2026-03-31 21:17:09 +03:30
parent 563b56e42b
commit 1ab72988cc
2 changed files with 38 additions and 10 deletions
+26 -10
View File
@@ -38,6 +38,11 @@ jobs:
goarch: amd64
- goos: android
goarch: arm64
- goos: android
goarch: arm
goarm: '7'
- goos: android
goarch: amd64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
@@ -67,6 +72,7 @@ jobs:
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
CGO_ENABLED: '0'
run: |
VERSION=${GITHUB_REF_NAME:-dev}
@@ -106,11 +112,19 @@ jobs:
- name: Stage Android client binary as JNI library
run: |
test -f artifacts/thefeed-client-android-arm64
# Package binary as .so in jniLibs so the installer places it in
# nativeLibraryDir the only Android-permitted exec location (W^X policy).
# Package binaries as .so in jniLibs — Android installer extracts only the
# folder matching the device ABI into nativeLibraryDir (the only exec-safe
# location under Android's W^X policy). ABI splits in build.gradle ensure
# the arm64 APK only contains arm64-v8a and universal contains all three.
mkdir -p android/app/src/main/jniLibs/arm64-v8a
mkdir -p android/app/src/main/jniLibs/armeabi-v7a
mkdir -p android/app/src/main/jniLibs/x86_64
test -f artifacts/thefeed-client-android-arm64
cp artifacts/thefeed-client-android-arm64 android/app/src/main/jniLibs/arm64-v8a/libthefeed.so
test -f artifacts/thefeed-client-android-arm
cp artifacts/thefeed-client-android-arm android/app/src/main/jniLibs/armeabi-v7a/libthefeed.so
test -f artifacts/thefeed-client-android-amd64
cp artifacts/thefeed-client-android-amd64 android/app/src/main/jniLibs/x86_64/libthefeed.so
- name: Decode signing keystore
if: env.KEYSTORE_BASE64 != ''
@@ -142,19 +156,21 @@ jobs:
./gradlew --no-daemon assembleDebug
fi
- name: Rename APK
- name: Rename APKs
run: |
if [ -f android/app/build/outputs/apk/release/app-release.apk ]; then
cp android/app/build/outputs/apk/release/app-release.apk artifacts/thefeed-android-arm64.apk
else
cp android/app/build/outputs/apk/debug/app-debug.apk artifacts/thefeed-android-arm64.apk
fi
if [ -f android/app/keystore.jks ]; then BT=release; else BT=debug; fi
ARM64=$(find android/app/build/outputs/apk/$BT -name "*arm64*" | head -1)
UNIVERSAL=$(find android/app/build/outputs/apk/$BT -name "*universal*" | head -1)
[ -n "$ARM64" ] && cp "$ARM64" artifacts/thefeed-android-arm64.apk
[ -n "$UNIVERSAL" ] && cp "$UNIVERSAL" artifacts/thefeed-android-universal.apk
- name: Upload Android APK artifact
uses: actions/upload-artifact@v4
with:
name: thefeed-android-apk
path: artifacts/thefeed-android-arm64.apk
path: |
artifacts/thefeed-android-arm64.apk
artifacts/thefeed-android-universal.apk
release:
needs: [build, android-apk]