This is a GitHub Action that creates a universal APK file from an AAB(Android App Bundle) file. APK file is useful for testing on real devices.
All inputs are required. Cannot be omitted.
Path to the AAB file used for generation.
Items required to sign the APK file. See: https://developer.android.com/studio/publish/app-signing
Since these are confidential information, it is recommended to use the values of secerts.
For keystore-base64
, specify the string generated from the keystore file as follows:
$ cat release.keystore | base64
Path to the generated APK file.
Minimal usage to generate an APK file from an existing AAB file:
- uses: snnaplab/universal-apk-generate-action@v1
id: apk-generate
with:
aab-path: 'app/build/outputs/bundle/release/app-release.aab'
keystore-base64: ${{ secrets.KEYSTORE_BASE64 }}
keystore-password: ${{ secrets.KEYSTORE_PASSWORD }}
key-alias: ${{ secrets.KEY_ALIAS }}
key-password: ${{ secrets.KEY_PASSWORD }}
- run: ls '${{ steps.apk-generate.outputs.apk-path }}'
Build when release tag is pushed and upload AAB file and APK file to Artifacts:
name: Release Build
on:
push:
tags:
- 'release/**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out Android project
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
- name: Build with Gradle
run: ./gradlew bundleRelease
- name: Get AAB file path
id: aab-path
run: echo "path=$(find . -regex '^.*/build/outputs/bundle/.*\.aab$' -type f | head -1)" >> $GITHUB_OUTPUT
- name: Upload AAB file to Artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ steps.aab-path.outputs.path }}
- name: Generate Universal APK file
uses: snnaplab/universal-apk-generate-action@v1
id: apk-generate
with:
aab-path: ${{ steps.aab-path.outputs.path }}
keystore-base64: ${{ secrets.KEYSTORE_BASE64 }}
keystore-password: ${{ secrets.KEYSTORE_PASSWORD }}
key-alias: ${{ secrets.KEY_ALIAS }}
key-password: ${{ secrets.KEY_PASSWORD }}
- name: Upload APK file to Artifacts
uses: actions/upload-artifact@v3
with:
path: ${{ steps.apk-generate.outputs.apk-path }}