Skip existing release assets instead of replacing them

This commit is contained in:
2026-07-31 17:14:40 +08:00
parent 7575a2f807
commit 0895501234
+3 -3
View File
@@ -326,9 +326,9 @@ jobs:
foreach ($artifact in $artifacts) {
$existing = @($release.assets | Where-Object name -eq $artifact.Name)
foreach ($asset in $existing) {
Invoke-RestMethod -Method Delete -Headers $headers -Uri "$api/releases/assets/$($asset.id)" | Out-Null
Write-Host "replaced asset: $($artifact.Name)"
if ($existing.Count -gt 0) {
Write-Host "asset already exists, skipping: $($artifact.Name)"
continue
}
Invoke-RestMethod -Method Post -Headers $headers -Uri "$api/releases/$($release.id)/assets?name=$($artifact.Name)" -Form @{ attachment = Get-Item $artifact.FullName } | Out-Null
Write-Host "uploaded asset: $($artifact.Name)"