@@ -189,27 +189,37 @@ runs:
189
189
shell : bash
190
190
working-directory : ${{ inputs.working-directory }}
191
191
192
+ # Find artifact URL again before uploading, as other concurrent workflows could upload the same artifact
193
+ - name : Find artifact URL again before uploading
194
+ id : find-artifact-after-build
195
+ uses : callstackincubator/android/.github/actions/find-artifact@v1
196
+ with :
197
+ name : ${{ env.ARTIFACT_NAME }}
198
+ re-sign : ${{ inputs.re-sign }}
199
+ github-token : ${{ inputs.github-token }}
200
+ pr-number : ${{ github.event.pull_request.number }}
201
+
192
202
- name : Upload Artifact
193
203
id : upload-artifact
194
- if : ${{ !steps.find-artifact.outputs.artifact-url || (inputs.re-sign == 'true' && github.event_name == 'pull_request') }}
204
+ if : ${{ !steps.find-artifact-after-build .outputs.artifact-url || (inputs.re-sign == 'true' && github.event_name == 'pull_request') }}
195
205
uses : actions/upload-artifact@v4
196
206
with :
197
- name : ${{ steps.find-artifact.outputs.artifact-name || env.ARTIFACT_NAME }}
207
+ name : ${{ steps.find-artifact-after-build .outputs.artifact-name || env.ARTIFACT_NAME }}
198
208
path : ${{ env.ARTIFACT_PATH }}
199
209
if-no-files-found : error
200
210
201
211
- name : Delete Old Re-Signed Artifacts
202
- if : ${{ steps.find-artifact.outputs.artifact-url && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
212
+ if : ${{ steps.find-artifact-after-build .outputs.artifact-url && inputs.re-sign == 'true' && github.event_name == 'pull_request' }}
203
213
run : |
204
- for ID in ${{ steps.find-artifact.outputs.artifact-ids }}; do
214
+ for ID in ${{ steps.find-artifact-after-build .outputs.artifact-ids }}; do
205
215
echo "Deleting artifact with ID: $ID"
206
216
curl -X DELETE -H "Authorization: token ${{ inputs.github-token }}" \
207
217
"https://api.github.com/repos/${{ github.repository }}/actions/artifacts/$ID"
208
218
done
209
219
shell : bash
210
220
211
221
- name : Clean Up Keystore and gradle properties (signed builds only)
212
- if : ${{ !steps.find-artifact.outputs.artifact-url && inputs.sign }}
222
+ if : ${{ !steps.find-artifact-after-build .outputs.artifact-url && inputs.sign }}
213
223
run : |
214
224
rm $HOME/.gradle/gradle.properties
215
225
rm $ANDROID_SOURCE_DIR/$APP_NAME/release.keystore
@@ -220,5 +230,5 @@ runs:
220
230
uses : callstackincubator/android/.github/actions/rnef-post-build@v1
221
231
with :
222
232
title : Android ${{ inputs.variant }} APK for all devices
223
- artifact-url : ${{ steps.upload-artifact.outputs.artifact-url || steps.find-artifact.outputs.artifact-url }}
233
+ artifact-url : ${{ steps.upload-artifact.outputs.artifact-url || steps.find-artifact-after-build .outputs.artifact-url }}
224
234
github-token : ${{ inputs.github-token }}
0 commit comments