@@ -102,14 +102,14 @@ runs:
102
102
- name : Native Fingerprint
103
103
id : fingerprint
104
104
run : |
105
- FINGERPRINT_OUTPUT=$(npx rock fingerprint -p ios --raw)
105
+ FINGERPRINT_OUTPUT=$(npx rock fingerprint -p ios --raw) || (echo "$FINGERPRINT_OUTPUT" && exit 1)
106
106
echo "FINGERPRINT=$FINGERPRINT_OUTPUT" >> $GITHUB_ENV
107
107
shell : bash
108
108
working-directory : ${{ inputs.working-directory }}
109
109
110
110
- name : Get Provider Name
111
111
run : |
112
- PROVIDER_NAME=$(npx rock remote-cache get-provider-name)
112
+ PROVIDER_NAME=$(npx rock remote-cache get-provider-name) || (echo "$PROVIDER_NAME" && exit 1)
113
113
echo "PROVIDER_NAME=$PROVIDER_NAME" >> $GITHUB_ENV
114
114
shell : bash
115
115
working-directory : ${{ inputs.working-directory }}
@@ -128,7 +128,7 @@ runs:
128
128
ARTIFACT_TRAITS="${{ inputs.destination }},${{ inputs.configuration }},${{ github.event.pull_request.number}}"
129
129
echo "ARTIFACT_TRAITS=$ARTIFACT_TRAITS" >> $GITHUB_ENV
130
130
131
- OUTPUT=$(npx rock remote-cache list -p ios --traits "${ARTIFACT_TRAITS}" --json)
131
+ OUTPUT=$(npx rock remote-cache list -p ios --traits "${ARTIFACT_TRAITS}" --json) || (echo "$OUTPUT" && exit 1)
132
132
if [ "$OUTPUT" ]; then
133
133
echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
134
134
echo "ARTIFACT_ID=$(echo "$OUTPUT" | jq -r '.id')" >> $GITHUB_ENV
@@ -142,7 +142,7 @@ runs:
142
142
ARTIFACT_TRAITS="${{ inputs.destination }},${{ inputs.configuration }}"
143
143
echo "ARTIFACT_TRAITS=$ARTIFACT_TRAITS" >> $GITHUB_ENV
144
144
145
- OUTPUT=$(npx rock remote-cache list -p ios --traits "${ARTIFACT_TRAITS}" --json)
145
+ OUTPUT=$(npx rock remote-cache list -p ios --traits "${ARTIFACT_TRAITS}" --json) || (echo "$OUTPUT" && exit 1)
146
146
if [ "$OUTPUT" ]; then
147
147
echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
148
148
echo "ARTIFACT_ID=$(echo "$OUTPUT" | jq -r '.id')" >> $GITHUB_ENV
@@ -198,7 +198,7 @@ runs:
198
198
- name : Determine iOS sourceDir
199
199
if : ${{ !env.ARTIFACT_URL }}
200
200
run : |
201
- JSON_OUTPUT=$(npx rock config -p ios)
201
+ JSON_OUTPUT=$(npx rock config -p ios) || (echo "$JSON_OUTPUT" && exit 1)
202
202
echo "$JSON_OUTPUT" | jq -r '.project'
203
203
IOS_SOURCE_DIR=$(echo "$JSON_OUTPUT" | jq -r '.project.ios.sourceDir')
204
204
echo "IOS_SOURCE_DIR=$IOS_SOURCE_DIR" >> $GITHUB_ENV
@@ -242,15 +242,15 @@ runs:
242
242
- name : Download and Unpack IPA
243
243
if : ${{ env.ARTIFACT_URL && inputs.destination == 'device' && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
244
244
run : |
245
- DOWNLOAD_OUTPUT=$(npx rock remote-cache download --name ${{ env.ARTIFACT_NAME }} --json)
245
+ DOWNLOAD_OUTPUT=$(npx rock remote-cache download --name ${{ env.ARTIFACT_NAME }} --json) || (echo "$DOWNLOAD_OUTPUT" && exit 1)
246
246
IPA_PATH=$(echo "$DOWNLOAD_OUTPUT" | jq -r '.path')
247
247
echo "ARTIFACT_PATH=$IPA_PATH" >> $GITHUB_ENV
248
248
shell : bash
249
249
250
250
- name : Download and Unpack APP
251
251
if : ${{ env.ARTIFACT_URL && inputs.destination == 'simulator' && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
252
252
run : |
253
- DOWNLOAD_OUTPUT=$(npx rock remote-cache download --name ${{ env.ARTIFACT_NAME }} --json)
253
+ DOWNLOAD_OUTPUT=$(npx rock remote-cache download --name ${{ env.ARTIFACT_NAME }} --json) || (echo "$DOWNLOAD_OUTPUT" && exit 1)
254
254
APP_PATH=$(echo "$DOWNLOAD_OUTPUT" | jq -r '.path')
255
255
APP_DIR=$(dirname "$APP_PATH")
256
256
APP_BASENAME=$(basename "$APP_PATH")
@@ -293,7 +293,7 @@ runs:
293
293
# Find artifact URL again before uploading, as other concurrent workflows could upload the same artifact
294
294
- name : Find artifact URL again before uploading
295
295
run : |
296
- OUTPUT=$(npx rock remote-cache list --name ${{ env.ARTIFACT_NAME }} --json)
296
+ OUTPUT=$(npx rock remote-cache list --name ${{ env.ARTIFACT_NAME }} --json) || (echo "$OUTPUT" && exit 1)
297
297
if [ -z "$OUTPUT" ]; then
298
298
echo "No artifact found"
299
299
else
@@ -312,24 +312,28 @@ runs:
312
312
path : ${{ env.ARTIFACT_PATH }}
313
313
if-no-files-found : error
314
314
315
+ # For re-signed builds, the ARTIFACT_NAME may contain PR-number, while Rock will save the artifact without PR trait in its cache.
316
+ # We need to upload the artifact with the PR-number in the name, that's why we use --binary-path with appropriate ARTIFACT_PATH that accounts for it.
315
317
- name : Upload Artifact to Remote Cache for re-signed builds
316
318
if : ${{ env.PROVIDER_NAME != 'GitHub' && (inputs.re-sign == 'true' && github.event_name == 'pull_request') }}
317
319
run : |
318
- OUTPUT=$(npx rock remote-cache upload --name ${{ env.ARTIFACT_NAME }} --binary-path ${{ env.ARTIFACT_PATH }} --json)
320
+ OUTPUT=$(npx rock remote-cache upload --name ${{ env.ARTIFACT_NAME }} --binary-path ${{ env.ARTIFACT_PATH }} --json) || (echo "$OUTPUT" && exit 1)
319
321
echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
320
322
shell : bash
321
323
322
324
- name : Upload Artifact to Remote Cache for regular builds
323
325
if : ${{ env.PROVIDER_NAME != 'GitHub' && !env.ARTIFACT_URL }}
324
326
run : |
325
- OUTPUT=$(npx rock remote-cache upload --name ${{ env.ARTIFACT_NAME }} --json)
327
+ OUTPUT=$(npx rock remote-cache upload --name ${{ env.ARTIFACT_NAME }} --json) || (echo "$OUTPUT" && exit 1)
326
328
echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
327
329
shell : bash
328
330
331
+ # For ad-hoc builds, the ARTIFACT_NAME may contain PR-number, while Rock will save the artifact without PR trait in its cache.
332
+ # We need to upload the artifact with the PR-number in the name, that's why we use --binary-path with appropriate ARTIFACT_PATH that accounts for it.
329
333
- name : Upload for Ad-hoc distribution
330
334
if : ${{ env.PROVIDER_NAME != 'GitHub' && inputs.ad-hoc == 'true' }}
331
335
run : |
332
- OUTPUT=$(npx rock remote-cache upload --name ${{ env.ARTIFACT_NAME }} --json --ad-hoc)
336
+ OUTPUT=$(npx rock remote-cache upload --name ${{ env.ARTIFACT_NAME }} --binary-path ${{ env.ARTIFACT_PATH }} -- json --ad-hoc) || (echo "$OUTPUT" && exit 1 )
333
337
echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
334
338
shell : bash
335
339
0 commit comments