Skip to content

Commit 0a70afc

Browse files
authored
feat: re-bundle APP when for simulator destinations (#10)
* feat: re-bundle APP when for simulator destinations * adjust conditionals * add step to download/unpack app * fixup * udpate artifact name * update paths
1 parent 756a82d commit 0a70afc

1 file changed

Lines changed: 38 additions & 4 deletions

File tree

action.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ inputs:
2424
description: Xcode configuration
2525
required: true
2626
re-sign:
27-
description: Re-sign the app bundle with new JS bundle
27+
description: Re-sign IPA with new JS bundle. No signing is done for APP bundle (destination == simulator).
2828
required: false
2929
certificate-base64:
3030
description: '[Device Builds] Base64 encoded P12 file containing Apple certificate (incl. private key)'
@@ -161,7 +161,7 @@ runs:
161161
shell: bash
162162

163163
- name: Setup Code Signing (device builds only)
164-
if: ${{ inputs.re-sign == 'true' || (!env.ARTIFACT_URL && inputs.destination == 'device') }}
164+
if: ${{ inputs.re-sign == 'true' && inputs.destination == 'device' || (!env.ARTIFACT_URL && inputs.destination == 'device') }}
165165
run: |
166166
# Create temporary keychain
167167
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
@@ -211,7 +211,7 @@ runs:
211211
--build-folder build \
212212
--destination ${{ inputs.destination }} \
213213
--verbose \
214-
${{ inputs.rnef-build-extra-params }}
214+
${{ inputs.rnef-build-extra-params }}
215215
shell: bash
216216
working-directory: ${{ inputs.working-directory }}
217217

@@ -243,6 +243,21 @@ runs:
243243
echo "ARTIFACT_PATH=$IPA_PATH" >> $GITHUB_ENV
244244
shell: bash
245245

246+
- name: Download and Unpack APP
247+
if: ${{ env.ARTIFACT_URL && inputs.destination == 'simulator' && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
248+
run: |
249+
DOWNLOAD_OUTPUT=$(npx rnef remote-cache download --name ${{ env.ARTIFACT_NAME }} --json)
250+
APP_PATH=$(echo "$DOWNLOAD_OUTPUT" | jq -r '.path')
251+
APP_DIR=$(dirname "$APP_PATH")
252+
APP_BASENAME=$(basename "$APP_PATH")
253+
254+
tar -C "$APP_DIR" -xzf "$APP_PATH"
255+
EXTRACTED_APP=$(find "$APP_DIR" -name "*.app" -type d | head -1)
256+
257+
echo "ARTIFACT_PATH=$APP_PATH" >> $GITHUB_ENV
258+
echo "ARTIFACT_TAR_PATH=$EXTRACTED_APP" >> $GITHUB_ENV
259+
shell: bash
260+
246261
- name: Re-sign IPA
247262
if: ${{ env.ARTIFACT_URL && inputs.destination == 'device' && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
248263
run: |
@@ -252,6 +267,25 @@ runs:
252267
shell: bash
253268
working-directory: ${{ inputs.working-directory }}
254269

270+
- name: Re-bundle APP
271+
if: ${{ env.ARTIFACT_URL && inputs.destination == 'simulator' && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
272+
run: |
273+
npx rnef sign:ios ${{ env.ARTIFACT_TAR_PATH }} \
274+
--build-jsbundle \
275+
--app
276+
shell: bash
277+
working-directory: ${{ inputs.working-directory }}
278+
279+
- name: Update Artifact Name for re-signed builds
280+
if: ${{ github.event_name == 'pull_request' && inputs.re-sign == 'true' }}
281+
run: |
282+
ARTIFACT_TRAITS="${{ inputs.destination }},${{ inputs.configuration }},${{ github.event.pull_request.number}}"
283+
ARTIFACT_TRAITS_HYPHENATED=$(echo "$ARTIFACT_TRAITS" | tr ',' '-')
284+
ARTIFACT_TRAITS_HYPHENATED_FINGERPRINT="${ARTIFACT_TRAITS_HYPHENATED}-${FINGERPRINT}"
285+
echo "ARTIFACT_NAME=rnef-ios-${ARTIFACT_TRAITS_HYPHENATED_FINGERPRINT}" >> $GITHUB_ENV
286+
echo "ARTIFACT_TRAITS=$ARTIFACT_TRAITS" >> $GITHUB_ENV
287+
shell: bash
288+
255289
# Find artifact URL again before uploading, as other concurrent workflows could upload the same artifact
256290
- name: Find artifact URL again before uploading
257291
run: |
@@ -289,7 +323,7 @@ runs:
289323
shell: bash
290324

291325
- name: Delete Old Re-Signed Artifacts
292-
if: ${{ env.ARTIFACT_URL && inputs.destination == 'device' && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
326+
if: ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
293327
run: |
294328
npx rnef remote-cache delete --name ${{ env.ARTIFACT_NAME }} --all-but-latest --json
295329
shell: bash

0 commit comments

Comments
 (0)