Skip to content

Commit fa2f267

Browse files
authored
Support AAB (#13)
* Support AAB * Build Type * less keystore variables * Update README.md * Revert "less keystore variables" This reverts commit 0ac4854. * Update README.md * Update action.yml * Update action.yml * Update action.yml * Update action.yml
1 parent 2177ac6 commit fa2f267

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
# keystore-key-alias: 'your-key-alias'
4545
# keystore-key-password: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
4646
# keystore-path: 'tools/buildtools/upload-key.keystore' # Optional: for custom keystore locations
47+
# For store AAB add this:
48+
# aab: true
4749
```
4850

4951
## Inputs
@@ -55,6 +57,7 @@ jobs:
5557
| `validate-gradle-wrapper` | Whether to validate the Gradle wrapper | No | `true` |
5658
| `setup-java` | Whether to run actions/setup-java action | No | `true` |
5759
| `variant` | Build variant (debug/release) | No | `debug` |
60+
| `aab` | Build Android App Bundle instead of APK | No | `false` |
5861
| `sign` | Whether to sign the build with keystore | No | - |
5962
| `re-sign` | Re-sign the APK with new JS bundle | No | `false` |
6063
| `keystore-file` | Path to the keystore file | No | - |

action.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ inputs:
2525
description: 'Build variant'
2626
required: false
2727
default: 'debug'
28+
aab:
29+
description: 'Build Android App Bundle instead of APK'
30+
required: false
31+
default: false
2832
rock-build-extra-params:
2933
description: 'Extra parameters to pass to "rock build:android"'
3034
required: false
@@ -123,6 +127,11 @@ runs:
123127
shell: bash
124128
working-directory: ${{ inputs.working-directory }}
125129

130+
- name: Set Binary Ext
131+
run: |
132+
echo "BINARY_EXT=${{ inputs.aab == 'true' && 'aab' || 'apk' }}" >> $GITHUB_ENV
133+
shell: bash
134+
126135
- name: Get Provider Name
127136
run: |
128137
PROVIDER_NAME=$(npx rock remote-cache get-provider-name) || (echo "$PROVIDER_NAME" && exit 1)
@@ -248,27 +257,28 @@ runs:
248257
run: |
249258
npx rock build:android \
250259
--variant "${{ inputs.variant }}" \
260+
${{ env.BINARY_EXT == 'aab' && '--aab' || '' }} \
251261
${{ inputs.rock-build-extra-params }}
252262
shell: bash
253263
working-directory: ${{ inputs.working-directory }}
254264

255265
- name: Find Build Artifact
256266
if: ${{ !env.ARTIFACT_URL }}
257267
run: |
258-
APK_PATH=$(find $ANDROID_SOURCE_DIR/$APP_NAME/build/outputs -name '*.apk' | head -1 )
259-
echo APK_PATH $APK_PATH
260-
echo "ARTIFACT_PATH=$APK_PATH" >> $GITHUB_ENV
268+
BINARY_PATH=$(find $ANDROID_SOURCE_DIR/$APP_NAME/build/outputs -name '*.${{ env.BINARY_EXT }}' | head -1 )
269+
echo BINARY_PATH $BINARY_PATH
270+
echo "ARTIFACT_PATH=$BINARY_PATH" >> $GITHUB_ENV
261271
shell: bash
262272

263-
- name: Download and Unpack APK
273+
- name: Download and Unpack Binary
264274
if: ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' }}
265275
run: |
266276
DOWNLOAD_OUTPUT=$(npx rock remote-cache download --name ${{ env.ARTIFACT_NAME }} --json) || (echo "$DOWNLOAD_OUTPUT" && exit 1)
267-
APK_PATH=$(echo "$DOWNLOAD_OUTPUT" | jq -r '.path')
268-
echo "ARTIFACT_PATH=$APK_PATH" >> $GITHUB_ENV
277+
BINARY_PATH=$(echo "$DOWNLOAD_OUTPUT" | jq -r '.path')
278+
echo "ARTIFACT_PATH=$BINARY_PATH" >> $GITHUB_ENV
269279
shell: bash
270280

271-
- name: Re-sign APK
281+
- name: Re-sign Binary
272282
if: ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' }}
273283
run: |
274284
npx rock sign:android "${{ env.ARTIFACT_PATH }}" \
@@ -371,6 +381,6 @@ runs:
371381
if: ${{ github.event_name == 'pull_request' && inputs.comment-bot == 'true' }}
372382
uses: callstackincubator/android/.github/actions/rock-post-build@v3
373383
with:
374-
title: Android ${{ inputs.variant }} APK for all devices
384+
title: Android ${{ inputs.variant }} Binary for all devices
375385
artifact-url: ${{ steps.upload-artifact.outputs.artifact-url || env.ARTIFACT_URL }}
376386
github-token: ${{ inputs.github-token }}

0 commit comments

Comments
 (0)