Skip to content

Commit f33bce2

Browse files
Clean the release artifacts before the upload
1 parent 0d46ac6 commit f33bce2

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/jarbuild.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,14 +496,31 @@ jobs:
496496
version=${ver%-rc*}
497497
version=${version#v}
498498
rc=${ver#*-rc}
499+
500+
# Create release if it doesn't exist, or skip if it does
499501
gh release create ${{github.event.inputs.release_tag_name}} \
500502
--generate-notes \
501503
--prerelease \
502504
--repo ${GITHUB_REPOSITORY} \
503505
--title "Apache Arrow Java ${version} RC${rc}" \
504-
--verify-tag
506+
--verify-tag || echo "Release already exists, will update artifacts..."
507+
508+
# Delete all existing assets from the release
509+
echo "Deleting existing artifacts..."
510+
gh release view ${{github.event.inputs.release_tag_name}} \
511+
--repo ${GITHUB_REPOSITORY} \
512+
--json assets \
513+
--jq '.assets[].name' | while read asset; do
514+
echo "Deleting asset: $asset"
515+
gh release delete-asset ${{github.event.inputs.release_tag_name}} \
516+
"$asset" \
517+
--repo ${GITHUB_REPOSITORY} \
518+
--yes || true
519+
done
520+
505521
# GitHub CLI does not respect their own rate limits
506522
# https://github.com/cli/cli/issues/9586
523+
echo "Uploading new artifacts..."
507524
for artifact in artifacts/*/*; do
508525
sleep 1
509526
gh release upload ${{github.event.inputs.release_tag_name}} \

0 commit comments

Comments
 (0)