Refactor Android build workflow for APK generation #68
This file contains hidden or 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: π¦ Expo EAS Android AAB β APK (Signed) | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| jobs: | |
| android-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: π§± Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: π§° Setup Expo & EAS | |
| uses: expo/expo-github-action@v8 | |
| with: | |
| eas-version: latest | |
| token: ${{ secrets.EXPO_TOKEN }} | |
| - name: π¦ Install dependencies | |
| run: npm install | |
| - name: π§© Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: π Restore keystore from Base64 | |
| run: | | |
| echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > keystore.jks | |
| - name: ποΈ Build Android AAB (local) | |
| run: eas build --platform android --profile production --local --non-interactive | |
| env: | |
| EAS_NO_VCS: 1 | |
| EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} | |
| ANDROID_KEYSTORE_PATH: keystore.jks | |
| ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
| ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
| ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
| - name: π₯ Download bundletool | |
| run: | | |
| curl -L -o bundletool.jar \ | |
| https://github.com/google/bundletool/releases/latest/download/bundletool-all.jar | |
| - name: π Convert AAB β SIGNED universal APK | |
| run: | | |
| AAB_PATH=$(find . -name "*.aab" | head -n 1) | |
| java -jar bundletool.jar build-apks \ | |
| --bundle=$AAB_PATH \ | |
| --output=app.apks \ | |
| --mode=universal \ | |
| --ks=keystore.jks \ | |
| --ks-key-alias=${{ secrets.ANDROID_KEY_ALIAS }} \ | |
| --ks-pass=pass:${{ secrets.ANDROID_KEYSTORE_PASSWORD }} \ | |
| --key-pass=pass:${{ secrets.ANDROID_KEY_PASSWORD }} | |
| unzip app.apks -d apk-output | |
| - name: π€ Upload AAB | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-aab | |
| path: "**/*.aab" | |
| - name: π€ Upload APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-apk | |
| path: apk-output/universal.apk |