Skip to content
Open
Changes from 1 commit
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
21 changes: 13 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 @@ -240,27 +244,28 @@ runs:
run: |
npx rock build:android \
--variant "${{ inputs.variant }}" \
${{ inputs.aab == 'true' && '--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 '*.${{ inputs.aab == 'true' && 'aab' || 'apk' }}' | head -1 )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's create BINARY_EXT variable and use that instead of ${{ inputs.aab == 'true' && 'aab' || 'apk' }}

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 @@ -342,6 +347,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 }}