Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 | - |
Expand Down
26 changes: 18 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -245,27 +254,28 @@ 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 }}

- 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 }}" \
Expand Down Expand Up @@ -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 }}