this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Enhance release workflow to handle edited releases and delete existing assets before upload

+21 -1
+21 -1
.github/workflows/build-and-release.yml
··· 2 2 3 3 on: 4 4 release: 5 - types: [created] 5 + types: [created, edited] 6 6 7 7 env: 8 8 ARCHIVE_NAME: AXe-macOS # Name for the release archive ··· 276 276 echo "❌ Package path not found: $PACKAGE_PATH" 277 277 exit 1 278 278 fi 279 + 280 + - name: Delete existing release asset (if re-running) 281 + continue-on-error: true 282 + run: | 283 + ASSET_NAME="${{ steps.create_archive.outputs.archive_name }}" 284 + echo "🗑️ Checking for existing asset: $ASSET_NAME" 285 + 286 + # Get the release ID 287 + RELEASE_ID=$(gh api repos/${{ github.repository }}/releases/tags/${{ steps.version.outputs.tag }} --jq '.id') 288 + 289 + # Try to delete existing asset with same name 290 + gh api repos/${{ github.repository }}/releases/$RELEASE_ID/assets --jq '.[] | select(.name == "'"$ASSET_NAME"'") | .id' | while read asset_id; do 291 + if [ -n "$asset_id" ]; then 292 + echo "🗑️ Deleting existing asset ID: $asset_id" 293 + gh api --method DELETE repos/${{ github.repository }}/releases/assets/$asset_id 294 + echo "✅ Existing asset deleted" 295 + fi 296 + done 297 + env: 298 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 279 299 280 300 - name: Upload release asset 281 301 uses: actions/upload-release-asset@v1