@@ -226,21 +226,36 @@ runs:
226226 shell : bash
227227
228228 - name : Download and Unpack APK
229- if : ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
229+ if : ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' }}
230230 run : |
231231 DOWNLOAD_OUTPUT=$(npx rock remote-cache download --name ${{ env.ARTIFACT_NAME }} --json) || (echo "$DOWNLOAD_OUTPUT" && exit 1)
232232 APK_PATH=$(echo "$DOWNLOAD_OUTPUT" | jq -r '.path')
233233 echo "ARTIFACT_PATH=$APK_PATH" >> $GITHUB_ENV
234234 shell : bash
235235
236236 - name : Re-sign APK
237- if : ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
237+ if : ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' }}
238238 run : |
239239 npx rock sign:android ${{ env.ARTIFACT_PATH }} \
240240 --build-jsbundle
241241 shell : bash
242242 working-directory : ${{ inputs.working-directory }}
243243
244+ - name : Update Artifact Name for re-signed builds
245+ if : ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' }}
246+ run : |
247+ if [ "${{ github.event_name }}" = "pull_request" ]; then
248+ IDENTIFIER="${{ github.event.pull_request.number }}"
249+ else
250+ IDENTIFIER="${{ github.sha }}"
251+ fi
252+ ARTIFACT_TRAITS="${{ inputs.variant }},${IDENTIFIER}"
253+ ARTIFACT_TRAITS_HYPHENATED=$(echo "$ARTIFACT_TRAITS" | tr ',' '-')
254+ ARTIFACT_TRAITS_HYPHENATED_FINGERPRINT="${ARTIFACT_TRAITS_HYPHENATED}-${FINGERPRINT}"
255+ echo "ARTIFACT_NAME=rock-ios-${ARTIFACT_TRAITS_HYPHENATED_FINGERPRINT}" >> $GITHUB_ENV
256+ echo "ARTIFACT_TRAITS=$ARTIFACT_TRAITS" >> $GITHUB_ENV
257+ shell : bash
258+
244259 # Find artifact URL again before uploading, as other concurrent workflows could upload the same artifact
245260 - name : Find artifact URL again before uploading
246261 run : |
@@ -255,7 +270,7 @@ runs:
255270 # Special case for GitHub, as it doesn't support uploading through the API
256271 - name : Upload Artifact to GitHub
257272 id : upload-artifact
258- if : ${{ env.PROVIDER_NAME == 'GitHub' && (!env.ARTIFACT_URL || ( inputs.re-sign == 'true' && github.event_name == 'pull_request') ) }}
273+ if : ${{ env.PROVIDER_NAME == 'GitHub' && (!env.ARTIFACT_URL || inputs.re-sign == 'true') }}
259274 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
260275 with :
261276 name : ${{ env.ARTIFACT_NAME }}
@@ -265,7 +280,7 @@ runs:
265280 # For re-signed builds, the ARTIFACT_NAME may contain PR-number, while Rock will save the artifact without PR trait in its cache.
266281 # 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.
267282 - name : Upload Artifact to Remote Cache for re-signed builds
268- if : ${{ env.PROVIDER_NAME != 'GitHub' && ( inputs.re-sign == 'true' && github.event_name == 'pull_request') }}
283+ if : ${{ env.PROVIDER_NAME != 'GitHub' && inputs.re-sign == 'true' }}
269284 run : |
270285 OUTPUT=$(npx rock remote-cache upload --name ${{ env.ARTIFACT_NAME }} --binary-path ${{ env.ARTIFACT_PATH }} --json --verbose) || (echo "$OUTPUT" && exit 1)
271286 echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
0 commit comments