oasis-wallet-web icon indicating copy to clipboard operation
oasis-wallet-web copied to clipboard

Add Android bundle to GitHub Action build artifacts

Open buberdds opened this issue 1 month ago • 7 comments

Release task has only AAB to avoid confusion what goes to Google app store. Build workflow has both AAB and APK (for testing). Sample fork output https://github.com/buberdds/oasis-wallet-web/actions/runs/9283327194

Alternative builds samples for future reference:

  1. using android-actions/setup-android@v3 action. Has hardcoded command line tools versions (may be outdated).
  2. manual instalation of Android command line tools. more ugly wokrflow, with hardoded url, but we control everything.
      - name: Download Command Line Tools
        # Expected location for sdkmanager is: <sdk>/cmdline-tools/latest/
        # CLI tools package https://developer.android.com/studio#command-line-tools-only
        run: |
          curl -o commandlinetools.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
          mkdir -p $HOME/android-sdk/cmdline-tools/latest
          unzip commandlinetools.zip -d $HOME/android-sdk/cmdline-tools
          mv $HOME/android-sdk/cmdline-tools/cmdline-tools/* $HOME/android-sdk/cmdline-tools/latest/
          rm -rf $HOME/android-sdk/cmdline-tools/cmdline-tools
      - name: Set up environment variables
        run: |
          echo "ANDROID_HOME=$HOME/android-sdk" >> $GITHUB_ENV
          echo "ANDROID_SDK_ROOT=$HOME/android-sdk" >> $GITHUB_ENV
          echo "PATH=$HOME/android-sdk/cmdline-tools/latest/bin:$PATH" >> $GITHUB_ENV
      - name: Accept SDK licenses
        run: yes | sdkmanager --licenses

      - name: Install SDK components
        run: |
          sdkmanager "platform-tools" "platforms;android-33" "build-tools;33.0.0"
      - name: Build Android ROSE Wallet
        run: ./gradlew bundleRelease
        working-directory: android

APK artifact alternative:

  • download bundletool jar end extract APK from AAB

TODO:

  • [x] build AAB file rather thank APK using gradlew bundleRelease instead of assembleRelease (actually we want both to speed up testing)
  • [x] confirm Java version used by workflow https://github.com/actions/setup-java?tab=readme-ov-file#supported-distributions. Should we use temurin distribution?
  • [x] confirm Android platform and build tools versions https://github.com/oasisprotocol/oasis-wallet-web/blob/master/android/app/src/main/AndroidManifest.xml#L40, so it's 31 ? It's 34 now after switching to Capacitor v6
  • [x] choose bundle build flow
  • [x] jarsigner
  • [x] confirm appId com.oasisprotocol.wallet - switch to org.
  • [x] update release workflow (fork sample: https://github.com/buberdds/oasis-wallet-web/releases/tag/v1.11.0)
  • [ ] add GitHub secrets to repo
  • [x] add apk for testing

GH secrets

  • generate keystore file
keytool -genkey -v -keystore <RELEASE_KEY_NAME>.jks -keyalg RSA -keysize 2048 -validity 10000 -alias <RELEASE_KEY_ALIAS>
  • encode keystore file in base64 format so it can be added as GitHub secret
base64 <RELEASE_KEY_NAME>.jks > <RELEASE_KEY_NAME>.jks.base64
  • provide all secrets in repo settings https://github.com/oasisprotocol/oasis-wallet-web/settings/secrets/actions -> New repository secret KEYSTORE_FILE , KEYSTORE_PASSWORD, KEY_ALIAS, KEY_PASSWORD

Dev after package name update (Android Studio)

  • File -> Sync Project with Gradle Files
  • Build -> Clean Project
  • Build -> Rebuild Project.

buberdds avatar May 21 '24 11:05 buberdds