Use build distribution #26
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android Release Build | |
on: | |
push: | |
branches: [ main ] | |
tags: [ '*' ] | |
pull_request: | |
branches: [ main ] | |
paths: [ android/** ] | |
release: | |
types: [ published ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./android | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Install Bundletool | |
run: | | |
wget https://github.com/google/bundletool/releases/download/1.17.0/bundletool-all-1.17.0.jar -O /usr/local/bin/bundletool.jar | |
- name: Decode Keystore | |
env: | |
ENCODED_KEYSTORE: ${{ secrets.ANDROID_RELEASE_KEYSTORE_BASE64 }} | |
DECODED_KEYSTORE_PATH: ${{ secrets.ANDROID_RELEASE_KEYSTORE_PATH }} | |
run: | | |
echo $ENCODED_KEYSTORE > keystore_base64.txt | |
base64 -d keystore_base64.txt > ./app/$DECODED_KEYSTORE_PATH | |
- name: Build AAB | |
env: | |
RUNNING_ENV: release_workflow | |
DECODED_KEYSTORE_PATH: ${{ secrets.ANDROID_RELEASE_KEYSTORE_PATH }} | |
RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEY_ALIAS }} | |
RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }} | |
RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }} | |
EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }} | |
REAPER_API_KEY: ${{ secrets.REAPER_API_KEY }} | |
ANDROID_DISTRIBUTION_API_KEY: ${{ secrets.ANDROID_DISTRIBUTION_API_KEY}} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
run: ./gradlew :app:bundleRelease | |
- name: Convert AAB to APK | |
run: | | |
java -jar /usr/local/bin/bundletool.jar build-apks \ | |
--mode=universal \ | |
--bundle=./app/build/outputs/bundle/release/app-release.aab \ | |
--output=./app/build/outputs/bundle/release/app-release.apks \ | |
--ks=./app/$DECODED_KEYSTORE_PATH \ | |
--ks-pass=pass:${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }} \ | |
--ks-key-alias=${{ secrets.ANDROID_RELEASE_KEY_ALIAS }} \ | |
--key-pass=${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }} | |
cd ${{ github.workspace }} && unzip ./app/build/outputs/bundle/release/app-release.apks | |
- name: Upload .apk | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ github.workspace }}/universal.apk | |
name: hackernews-universal-${{github.sha}}.apk | |
if-no-files-found: error |