Files
desktop-edge-win/scripts/verify-streams.ps1
Christopher Britton b16e80acf2 Switch release notes back to a single release-notes.md file (#1022)
* Switch release notes back to a single release-notes.md file

* Add CI check that GitHub's latest release matches latest.json

* Fix prepare-beta release note preview

* Get release note version number from version file, check win32 crypto 'latest' against latest.json in CI

* Split release notes archive into yearly release notes
2026-06-25 09:20:36 -04:00

68 lines
2.4 KiB
PowerShell

# Verifies that every browser_download_url in the release-streams JSON files is reachable.
# Skips versioned snapshot files (e.g. 2.9.5.0.json) and local dev files.
#
# Usage:
# .\verify-streams.ps1
# .\verify-streams.ps1 -StreamsDir .\release-streams
param(
[string]$StreamsDir = (Join-Path (Split-Path $PSScriptRoot -Parent) "release-streams"),
[switch]$CheckGitHubLatest
)
$failed = $false
$files = Get-ChildItem (Join-Path $StreamsDir "*.json") | Where-Object {
$_.BaseName -notmatch '^\d' -and $_.BaseName -notlike 'local*'
}
foreach ($file in $files) {
$json = Get-Content $file.FullName -Raw | ConvertFrom-Json
foreach ($asset in $json.assets) {
$url = $asset.browser_download_url
if (-not $url) { continue }
Write-Host "$($file.Name): $url ... " -NoNewline
try {
$resp = Invoke-WebRequest -Uri $url -Method Head -UseBasicParsing -ErrorAction Stop
Write-Host "OK ($($resp.StatusCode))" -ForegroundColor Green
} catch {
$status = $_.Exception.Response.StatusCode.value__
Write-Host "FAIL ($status)" -ForegroundColor Red
$failed = $true
}
}
}
if ($failed) {
Write-Error "One or more download URLs could not be reached."
exit 1
}
Write-Host "All URLs OK." -ForegroundColor Green
if ($CheckGitHubLatest) {
$latestJson = Join-Path $StreamsDir "latest.json"
if (-not (Test-Path $latestJson)) { Write-Error "latest.json not found at $latestJson"; exit 1 }
$tag = (Get-Content $latestJson -Raw | ConvertFrom-Json).tag_name
if (-not $tag) { Write-Error "latest.json has no tag_name"; exit 1 }
$win32Json = Join-Path $StreamsDir "latest-win32crypto.json"
if (-not (Test-Path $win32Json)) { Write-Error "latest-win32crypto.json not found at $win32Json"; exit 1 }
$win32Tag = (Get-Content $win32Json -Raw | ConvertFrom-Json).tag_name
if ($win32Tag -ne $tag) {
Write-Error "latest-win32crypto.json ($win32Tag) does not match latest.json ($tag)."
exit 1
}
$ghLatest = gh release view --json tagName --jq .tagName
if ($LASTEXITCODE -ne 0) { Write-Error "could not read GitHub's latest release"; exit 1 }
if ($ghLatest -ne $tag) {
Write-Error "GitHub latest ($ghLatest) does not match latest.json ($tag). Mark $tag as latest on GitHub."
exit 1
}
Write-Host "GitHub latest matches latest.json: $tag" -ForegroundColor Green
}