File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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"
You can’t perform that action at this time.
0 commit comments