@@ -102,14 +102,14 @@ runs:
102102 - name : Native Fingerprint
103103 id : fingerprint
104104 run : |
105- FINGERPRINT_OUTPUT=$(npx rock fingerprint -p ios --raw)
105+ FINGERPRINT_OUTPUT=$(npx rock fingerprint -p ios --raw) || (echo "$FINGERPRINT_OUTPUT" && exit 1)
106106 echo "FINGERPRINT=$FINGERPRINT_OUTPUT" >> $GITHUB_ENV
107107 shell : bash
108108 working-directory : ${{ inputs.working-directory }}
109109
110110 - name : Get Provider Name
111111 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)
113113 echo "PROVIDER_NAME=$PROVIDER_NAME" >> $GITHUB_ENV
114114 shell : bash
115115 working-directory : ${{ inputs.working-directory }}
@@ -128,7 +128,7 @@ runs:
128128 ARTIFACT_TRAITS="${{ inputs.destination }},${{ inputs.configuration }},${{ github.event.pull_request.number}}"
129129 echo "ARTIFACT_TRAITS=$ARTIFACT_TRAITS" >> $GITHUB_ENV
130130
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)
132132 if [ "$OUTPUT" ]; then
133133 echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
134134 echo "ARTIFACT_ID=$(echo "$OUTPUT" | jq -r '.id')" >> $GITHUB_ENV
@@ -142,7 +142,7 @@ runs:
142142 ARTIFACT_TRAITS="${{ inputs.destination }},${{ inputs.configuration }}"
143143 echo "ARTIFACT_TRAITS=$ARTIFACT_TRAITS" >> $GITHUB_ENV
144144
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)
146146 if [ "$OUTPUT" ]; then
147147 echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
148148 echo "ARTIFACT_ID=$(echo "$OUTPUT" | jq -r '.id')" >> $GITHUB_ENV
@@ -198,7 +198,7 @@ runs:
198198 - name : Determine iOS sourceDir
199199 if : ${{ !env.ARTIFACT_URL }}
200200 run : |
201- JSON_OUTPUT=$(npx rock config -p ios)
201+ JSON_OUTPUT=$(npx rock config -p ios) || (echo "$JSON_OUTPUT" && exit 1)
202202 echo "$JSON_OUTPUT" | jq -r '.project'
203203 IOS_SOURCE_DIR=$(echo "$JSON_OUTPUT" | jq -r '.project.ios.sourceDir')
204204 echo "IOS_SOURCE_DIR=$IOS_SOURCE_DIR" >> $GITHUB_ENV
@@ -242,15 +242,15 @@ runs:
242242 - name : Download and Unpack IPA
243243 if : ${{ env.ARTIFACT_URL && inputs.destination == 'device' && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
244244 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)
246246 IPA_PATH=$(echo "$DOWNLOAD_OUTPUT" | jq -r '.path')
247247 echo "ARTIFACT_PATH=$IPA_PATH" >> $GITHUB_ENV
248248 shell : bash
249249
250250 - name : Download and Unpack APP
251251 if : ${{ env.ARTIFACT_URL && inputs.destination == 'simulator' && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
252252 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)
254254 APP_PATH=$(echo "$DOWNLOAD_OUTPUT" | jq -r '.path')
255255 APP_DIR=$(dirname "$APP_PATH")
256256 APP_BASENAME=$(basename "$APP_PATH")
@@ -293,7 +293,7 @@ runs:
293293 # Find artifact URL again before uploading, as other concurrent workflows could upload the same artifact
294294 - name : Find artifact URL again before uploading
295295 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)
297297 if [ -z "$OUTPUT" ]; then
298298 echo "No artifact found"
299299 else
@@ -312,24 +312,28 @@ runs:
312312 path : ${{ env.ARTIFACT_PATH }}
313313 if-no-files-found : error
314314
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.
315317 - name : Upload Artifact to Remote Cache for re-signed builds
316318 if : ${{ env.PROVIDER_NAME != 'GitHub' && (inputs.re-sign == 'true' && github.event_name == 'pull_request') }}
317319 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)
319321 echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
320322 shell : bash
321323
322324 - name : Upload Artifact to Remote Cache for regular builds
323325 if : ${{ env.PROVIDER_NAME != 'GitHub' && !env.ARTIFACT_URL }}
324326 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)
326328 echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
327329 shell : bash
328330
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.
329333 - name : Upload for Ad-hoc distribution
330334 if : ${{ env.PROVIDER_NAME != 'GitHub' && inputs.ad-hoc == 'true' }}
331335 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 )
333337 echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
334338 shell : bash
335339
0 commit comments