Skip to content

Commit ee4de5c

Browse files
committed
try to fix duplicate binaries in release draft
1 parent 120a162 commit ee4de5c

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

.github/workflows/release-management.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,26 @@ jobs:
7171
env:
7272
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7373

74-
- name: Upload Release Asset
74+
- name: Replace Release Asset
7575
env:
7676
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7777
TAG_NAME: ${{ steps.release_drafter.outputs.tag_name }}
78+
ASSET_NAME: SU2-${{ steps.release_drafter.outputs.tag_name }}-${{ matrix.os_bin }}.zip
7879
run: |
80+
set -e
81+
82+
# Delete existing asset if present
83+
EXISTING_ASSET_ID=$(gh release view "$TAG_NAME" \
84+
--json assets \
85+
--jq ".assets[] | select(.name == \"$ASSET_NAME\") | .id")
86+
87+
if [ -n "$EXISTING_ASSET_ID" ]; then
88+
echo "Deleting existing asset: $ASSET_NAME"
89+
gh api \
90+
-X DELETE \
91+
repos/${{ github.repository }}/releases/assets/$EXISTING_ASSET_ID
92+
fi
93+
94+
# Upload new asset
7995
gh release upload "$TAG_NAME" \
80-
"${{ matrix.os_bin }}.zip#SU2-${TAG_NAME}-${{ matrix.os_bin }}.zip" \
81-
--clobber
96+
"${{ matrix.os_bin }}.zip#$ASSET_NAME"

0 commit comments

Comments
 (0)