From 220a969ddba28c53a8f999b36f18e9a26339ba14 Mon Sep 17 00:00:00 2001 From: lukeIam <2lukeiam@gmail.com> Date: Mon, 14 Aug 2017 15:51:02 +0200 Subject: [PATCH] Delete the whole release instead of just the assets before publishing (fixes #276). --- .appveyor/prepareDeploy.ps1 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.appveyor/prepareDeploy.ps1 b/.appveyor/prepareDeploy.ps1 index 922a6550..99ee09e2 100644 --- a/.appveyor/prepareDeploy.ps1 +++ b/.appveyor/prepareDeploy.ps1 @@ -23,20 +23,20 @@ catch [System.Net.WebException] # No Release found for this tag $statusCode = [int]$_.Exception.Response.StatusCode $html = $_.Exception.Response.StatusDescription - Write-Host "No Release found for this tag ($html): $($Env:APPVEYOR_REPO_TAG_NAME)" + Write-Host "No Release found for this tag ($html): $targetTag" Return; } -$assetId = ($result.assets | where {$_.name -EQ "Vocaluxe_$($Env:APPVEYOR_REPO_TAG_NAME)_Windows_$($Env:PLATFORM).zip" } | Select-Object -first 1 ).id +$releaseId = $result.id -if(!$assetId){ - # No matching asset found in this release - Write-Host "No matching asset found in this release: Vocaluxe_$($Env:APPVEYOR_REPO_TAG_NAME)_Windows_$($Env:PLATFORM).zip" +if(!$releaseId){ + # No matching release found in this release + Write-Host "No matching release found" Return; } $deleteAssetParams = @{ - Uri = "https://api.github.com/repos/Vocaluxe/Vocaluxe/releases/assets/$assetId"; + Uri = "https://api.github.com/repos/Vocaluxe/Vocaluxe/releases/$releaseId"; Method = 'DELETE'; Headers = @{ Authorization = 'Basic ' + [Convert]::ToBase64String( @@ -45,14 +45,14 @@ $deleteAssetParams = @{ } try{ $result = Invoke-RestMethod @deleteAssetParams - Write-Host "Successfully deleted asset: Vocaluxe_$($Env:APPVEYOR_REPO_TAG_NAME)_Windows_$($Env:PLATFORM).zip" + Write-Host "Successfully deleted release for: $targetTag" } catch [System.Net.WebException] { - # Could not delete asset + # Could not delete release $statusCode = [int]$_.Exception.Response.StatusCode $html = $_.Exception.Response.StatusDescription - Write-Host "Could not delete asset ($html): Vocaluxe_$($Env:APPVEYOR_REPO_TAG_NAME)_Windows_$($Env:PLATFORM).zip" + Write-Host "Could not delete release ($html) for: $targetTag" Return; } \ No newline at end of file