Skip to content

Commit 0bbc1b7

Browse files
authored
fix: pass keystore inputs in re-sign step (#18)
* fix: pass keystore inputs in re-sign step * fix: use KEYSTORE_TARGET_PATH
1 parent 25511c6 commit 0bbc1b7

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

action.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ runs:
202202
shell: bash
203203

204204
- name: Determine Android sourceDir and appName
205-
if: ${{ !env.ARTIFACT_URL }}
205+
if: ${{ !env.ARTIFACT_URL || (env.ARTIFACT_URL && inputs.re-sign) }}
206206
run: |
207207
JSON_OUTPUT=$(npx rock config -p android) || (echo "$JSON_OUTPUT" && exit 1)
208208
echo "$JSON_OUTPUT" | jq -r '.project'
@@ -214,7 +214,7 @@ runs:
214214
working-directory: ${{ inputs.working-directory }}
215215

216216
- name: Decode and store keystore file
217-
if: ${{ !env.ARTIFACT_URL && inputs.sign }}
217+
if: ${{ (!env.ARTIFACT_URL && inputs.sign) || (env.ARTIFACT_URL && inputs.re-sign) }}
218218
run: |
219219
if [ -n "$APP_NAME" ]; then
220220
KEYSTORE_TARGET_PATH="$ANDROID_SOURCE_DIR/$APP_NAME/${{ inputs.keystore-path }}"
@@ -236,6 +236,7 @@ runs:
236236
echo "${{ inputs.keystore-base64 }}" | base64 --decode > "$KEYSTORE_TARGET_PATH"
237237
echo "Successfully copied keystore base64 to target path: $KEYSTORE_TARGET_PATH"
238238
fi
239+
echo "KEYSTORE_TARGET_PATH=$KEYSTORE_TARGET_PATH" >> $GITHUB_ENV
239240
shell: bash
240241
working-directory: ${{ inputs.working-directory }}
241242

@@ -268,7 +269,11 @@ runs:
268269
if: ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' }}
269270
run: |
270271
npx rock sign:android "${{ env.ARTIFACT_PATH }}" \
271-
--build-jsbundle
272+
--build-jsbundle \
273+
--keystore "$KEYSTORE_TARGET_PATH" \
274+
--keystore-password "${{ inputs.keystore-store-password }}" \
275+
--key-alias "${{ inputs.keystore-key-alias }}" \
276+
--key-password "${{ inputs.keystore-key-password }}"
272277
shell: bash
273278
working-directory: ${{ inputs.working-directory }}
274279

@@ -339,10 +344,9 @@ runs:
339344
npx rock remote-cache delete --name ${{ env.ARTIFACT_NAME }} --all-but-latest --json
340345
shell: bash
341346

342-
- name: Clean Up Keystore and gradle properties (signed builds only)
343-
if: ${{ !env.ARTIFACT_URL && inputs.sign }}
347+
- name: Clean Up Keystore
348+
if: ${{ (!env.ARTIFACT_URL && inputs.sign) || (env.ARTIFACT_URL && inputs.re-sign) }}
344349
run: |
345-
rm $HOME/.gradle/gradle.properties
346350
if [ -n "$APP_NAME" ]; then
347351
rm "$ANDROID_SOURCE_DIR/$APP_NAME/${{ inputs.keystore-path }}"
348352
else
@@ -351,6 +355,13 @@ runs:
351355
shell: bash
352356
working-directory: ${{ inputs.working-directory }}
353357

358+
- name: Clean Up gradle properties (signed builds only)
359+
if: ${{ !env.ARTIFACT_URL && inputs.sign }}
360+
run: |
361+
rm $HOME/.gradle/gradle.properties
362+
shell: bash
363+
working-directory: ${{ inputs.working-directory }}
364+
354365
- name: Post Build
355366
if: ${{ github.event_name == 'pull_request' && inputs.comment-bot == 'true' }}
356367
uses: callstackincubator/android/.github/actions/rock-post-build@v3

0 commit comments

Comments
 (0)