From 8f9bad2cd44e008b5b82e9d3ab38c37b598d26e5 Mon Sep 17 00:00:00 2001 From: Benjamin Abt Date: Wed, 24 Dec 2025 15:04:12 +0100 Subject: [PATCH] feat(release): remove old NuGet packages before upload --- .github/workflows/main-build.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main-build.yml b/.github/workflows/main-build.yml index c0c71ec..b416dfc 100644 --- a/.github/workflows/main-build.yml +++ b/.github/workflows/main-build.yml @@ -66,7 +66,16 @@ jobs: TAG="v${{ needs.build-and-test.outputs.version }}" # Wait a moment for the release to be created sleep 2 - # Upload artifacts to the draft release + + # Remove old NuGet packages from the draft release + echo "🗑️ Removing old NuGet packages..." + gh release view "$TAG" --json assets --jq '.assets[].name' | grep '\.nupkg$' | while read -r asset; do + echo "Deleting old package: $asset" + gh api --method DELETE "/repos/${{ github.repository }}/releases/assets/$(gh release view "$TAG" --json assets --jq ".assets[] | select(.name == \"$asset\") | .id")" || true + done + + # Upload new artifacts to the draft release + echo "📦 Uploading new NuGet packages..." for file in ./artifacts/*.nupkg; do gh release upload "$TAG" "$file" --clobber done