Skip existing release assets instead of replacing them
This commit is contained in:
@@ -326,9 +326,9 @@ jobs:
|
|||||||
|
|
||||||
foreach ($artifact in $artifacts) {
|
foreach ($artifact in $artifacts) {
|
||||||
$existing = @($release.assets | Where-Object name -eq $artifact.Name)
|
$existing = @($release.assets | Where-Object name -eq $artifact.Name)
|
||||||
foreach ($asset in $existing) {
|
if ($existing.Count -gt 0) {
|
||||||
Invoke-RestMethod -Method Delete -Headers $headers -Uri "$api/releases/assets/$($asset.id)" | Out-Null
|
Write-Host "asset already exists, skipping: $($artifact.Name)"
|
||||||
Write-Host "replaced asset: $($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
|
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)"
|
Write-Host "uploaded asset: $($artifact.Name)"
|
||||||
|
|||||||
Reference in New Issue
Block a user