diff --git a/README.md b/README.md index dd5b4f0..6a17206 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,8 @@ jobs: # keystore-key-alias: 'your-key-alias' # keystore-key-password: ${{ secrets.KEYSTORE_KEY_PASSWORD }} # keystore-path: 'tools/buildtools/upload-key.keystore' # Optional: for custom keystore locations + # For store AAB add this: + # aab: true ``` ## Inputs @@ -55,6 +57,7 @@ jobs: | `validate-gradle-wrapper` | Whether to validate the Gradle wrapper | No | `true` | | `setup-java` | Whether to run actions/setup-java action | No | `true` | | `variant` | Build variant (debug/release) | No | `debug` | +| `aab` | Build Android App Bundle instead of APK | No | `false` | | `sign` | Whether to sign the build with keystore | No | - | | `re-sign` | Re-sign the APK with new JS bundle | No | `false` | | `keystore-file` | Path to the keystore file | No | - | diff --git a/action.yml b/action.yml index bfb828b..5ab57a0 100644 --- a/action.yml +++ b/action.yml @@ -25,6 +25,10 @@ inputs: description: 'Build variant' required: false default: 'debug' + aab: + description: 'Build Android App Bundle instead of APK' + required: false + default: false rock-build-extra-params: description: 'Extra parameters to pass to "rock build:android"' required: false @@ -120,6 +124,11 @@ runs: shell: bash working-directory: ${{ inputs.working-directory }} + - name: Set Binary Ext + run: | + echo "BINARY_EXT=${{ inputs.aab == 'true' && 'aab' || 'apk' }}" >> $GITHUB_ENV + shell: bash + - name: Get Provider Name run: | PROVIDER_NAME=$(npx rock remote-cache get-provider-name) || (echo "$PROVIDER_NAME" && exit 1) @@ -245,6 +254,7 @@ runs: run: | npx rock build:android \ --variant "${{ inputs.variant }}" \ + ${{ env.BINARY_EXT == 'aab' && '--aab' || '' }} \ ${{ inputs.rock-build-extra-params }} shell: bash working-directory: ${{ inputs.working-directory }} @@ -252,20 +262,20 @@ runs: - name: Find Build Artifact if: ${{ !env.ARTIFACT_URL }} run: | - APK_PATH=$(find $ANDROID_SOURCE_DIR/$APP_NAME/build/outputs -name '*.apk' | head -1 ) - echo APK_PATH $APK_PATH - echo "ARTIFACT_PATH=$APK_PATH" >> $GITHUB_ENV + BINARY_PATH=$(find $ANDROID_SOURCE_DIR/$APP_NAME/build/outputs -name '*.${{ env.BINARY_EXT }}' | head -1 ) + echo BINARY_PATH $BINARY_PATH + echo "ARTIFACT_PATH=$BINARY_PATH" >> $GITHUB_ENV shell: bash - - name: Download and Unpack APK + - name: Download and Unpack Binary if: ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' }} run: | DOWNLOAD_OUTPUT=$(npx rock remote-cache download --name ${{ env.ARTIFACT_NAME }} --json) || (echo "$DOWNLOAD_OUTPUT" && exit 1) - APK_PATH=$(echo "$DOWNLOAD_OUTPUT" | jq -r '.path') - echo "ARTIFACT_PATH=$APK_PATH" >> $GITHUB_ENV + BINARY_PATH=$(echo "$DOWNLOAD_OUTPUT" | jq -r '.path') + echo "ARTIFACT_PATH=$BINARY_PATH" >> $GITHUB_ENV shell: bash - - name: Re-sign APK + - name: Re-sign Binary if: ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' }} run: | npx rock sign:android "${{ env.ARTIFACT_PATH }}" \ @@ -366,6 +376,6 @@ runs: if: ${{ github.event_name == 'pull_request' && inputs.comment-bot == 'true' }} uses: callstackincubator/android/.github/actions/rock-post-build@v3 with: - title: Android ${{ inputs.variant }} APK for all devices + title: Android ${{ inputs.variant }} Binary for all devices artifact-url: ${{ steps.upload-artifact.outputs.artifact-url || env.ARTIFACT_URL }} github-token: ${{ inputs.github-token }}