Skip to content

Commit 9ac644a

Browse files
committed
Revert checksums.json asset creation
1 parent 30a080e commit 9ac644a

1 file changed

Lines changed: 0 additions & 45 deletions

File tree

action.ps1

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -193,51 +193,6 @@ $previousAssets = Invoke-RestMethod $event.release.assets_url @authHeaders -Foll
193193
# staged assets prepared for upload
194194
$stagedAssets = Get-ChildItem $stagingPath -Include *.json, *.bsi, *.bsr, *.gstz, *.catz -Recurse -File | Sort-Object -Property Name
195195

196-
# checksums: calculate, compare to uploaded if exists, stage if not or differs
197-
$checksums = [ordered]@{
198-
git_sha = $env:GITHUB_SHA
199-
files = [ordered]@{ }
200-
}
201-
$stagedAssets | ForEach-Object {
202-
$checksums.files[$_.Name] = (Get-FileHash $_).Hash
203-
}
204-
$checksumFilename = 'checksums.json'
205-
$checksumFilepath = Join-Path $stagingPath $checksumFilename
206-
$existingChecksumAsset = $previousAssets | Where-Object name -eq $checksumFilename
207-
if ($existingChecksumAsset) {
208-
# check previous checksums
209-
Write-Host "Downloading existing $checksumFilename for comparison."
210-
$apiArgs = @{
211-
Method = 'Get'
212-
Uri = $existingChecksumAsset.url
213-
OutFile = $checksumFilepath
214-
Headers = @{
215-
Accept = 'application/octet-stream'
216-
} + $authHeaders.Headers
217-
}
218-
$null = Invoke-RestMethod @apiArgs -MaximumRetryCount 5 -RetryIntervalSec 5
219-
$existingChecksums = Get-Content $checksumFilepath | ConvertFrom-Json
220-
$same = $checksums.git_sha -eq $existingChecksums.git_sha -and ($stagedAssets | Where-Object {
221-
$savedSha = $existingChecksums.files[$_.Name]
222-
$equal = $null -ne $savedSha -and $savedSha -eq $checksums.files[$_.Name]
223-
if (!$equal) {
224-
Write-Host "Checksum differs for '$($_.Name)'."
225-
}
226-
} | Select-Object -First 1)
227-
if ($same) {
228-
Write-Host "Checksums are the same. Skipping re-upload."
229-
exit 0
230-
}
231-
Write-Host "Checksums differ."
232-
}
233-
else {
234-
Write-Host "$checksumFilename isn't an existing asset."
235-
}
236-
Write-Host "Adding $checksumFilename to staged assets."
237-
$checksums | ConvertTo-Json -Compress | Set-Content $checksumFilepath
238-
$checksumFile = Get-Item $checksumFilepath
239-
$stagedAssets = @() + $checksumFile + $stagedAssets
240-
241196
# upload assets (delete old ones with the same name first)
242197
$stagedAssets | ForEach-Object {
243198
$name = $_.Name

0 commit comments

Comments
 (0)