Skip to content

Commit 92f1d97

Browse files
authored
feat(release): remove old NuGet packages before upload (#84)
1 parent b090c43 commit 92f1d97

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/main-build.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,16 @@ jobs:
6666
TAG="v${{ needs.build-and-test.outputs.version }}"
6767
# Wait a moment for the release to be created
6868
sleep 2
69-
# Upload artifacts to the draft release
69+
70+
# Remove old NuGet packages from the draft release
71+
echo "🗑️ Removing old NuGet packages..."
72+
gh release view "$TAG" --json assets --jq '.assets[].name' | grep '\.nupkg$' | while read -r asset; do
73+
echo "Deleting old package: $asset"
74+
gh api --method DELETE "/repos/${{ github.repository }}/releases/assets/$(gh release view "$TAG" --json assets --jq ".assets[] | select(.name == \"$asset\") | .id")" || true
75+
done
76+
77+
# Upload new artifacts to the draft release
78+
echo "📦 Uploading new NuGet packages..."
7079
for file in ./artifacts/*.nupkg; do
7180
gh release upload "$TAG" "$file" --clobber
7281
done

0 commit comments

Comments
 (0)