@@ -226,21 +226,27 @@ 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 not on pull requests
245+ if : ${{ env.ARTIFACT_URL && inputs.re-sign == 'true' && github.event_name != 'pull_request' }}
246+ run : |
247+ echo "ARTIFACT_NAME=$ARTIFACT_NAME-${{ github.sha }}" >> $GITHUB_ENV
248+ shell : bash
249+
244250 # Find artifact URL again before uploading, as other concurrent workflows could upload the same artifact
245251 - name : Find artifact URL again before uploading
246252 run : |
@@ -255,7 +261,7 @@ runs:
255261 # Special case for GitHub, as it doesn't support uploading through the API
256262 - name : Upload Artifact to GitHub
257263 id : upload-artifact
258- if : ${{ env.PROVIDER_NAME == 'GitHub' && (!env.ARTIFACT_URL || ( inputs.re-sign == 'true' && github.event_name == 'pull_request') ) }}
264+ if : ${{ env.PROVIDER_NAME == 'GitHub' && (!env.ARTIFACT_URL || inputs.re-sign == 'true') }}
259265 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
260266 with :
261267 name : ${{ env.ARTIFACT_NAME }}
@@ -265,7 +271,7 @@ runs:
265271 # For re-signed builds, the ARTIFACT_NAME may contain PR-number, while Rock will save the artifact without PR trait in its cache.
266272 # 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.
267273 - 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') }}
274+ if : ${{ env.PROVIDER_NAME != 'GitHub' && inputs.re-sign == 'true' }}
269275 run : |
270276 OUTPUT=$(npx rock remote-cache upload --name ${{ env.ARTIFACT_NAME }} --binary-path ${{ env.ARTIFACT_PATH }} --json --verbose) || (echo "$OUTPUT" && exit 1)
271277 echo "ARTIFACT_URL=$(echo "$OUTPUT" | jq -r '.url')" >> $GITHUB_ENV
0 commit comments