Bump to v1.7.0: self-updater release-filtering fix

The client and the relay server are published from the same GitHub repo;
the server's releases use "server-" prefixed tags. RemSoundUpdater hit
/releases/latest, which is repo-wide — when a server release was newest,
the updater fed "server-v2.3" to ParseTag (-> a bogus 0.0.3) and concluded
"up to date", silently skipping real client updates.

CheckForUpdateAsync now lists /releases and picks the highest-versioned
release whose tag is a RemSound client tag (new IsClientReleaseTag: after
an optional leading "v", first char must be a digit). Drafts and
pre-releases are skipped. The server-side updater already filters to
"server-" tags, so client + server coexist in one repo cleanly.

Also rewrites build-release.ps1 with a data-safety check: it publishes to
a fresh staging folder and aborts the release if any logs/, profiles/,
recordings/ folder, .log file or remsound.config.json is present in the
staged output or the finished zip — preventing a repeat of the v1.5/v1.6
zips that shipped with developer logs and profiles.

No wire-format or audio-pipeline changes — v1.5/v1.6/v1.7 interoperate.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-05-18 22:05:40 +01:00
co-authored by Claude Opus 4.7
parent 918ca6cac0
commit 6b1ae2d017
5 changed files with 157 additions and 38 deletions
+89 -24
View File
@@ -1,42 +1,107 @@
# Build script for a tagged RemSound release.
# build-release.ps1 — produce the RemSound client release zip, and PROVE it carries
# no personal data before it can ship.
#
# .\build-release.ps1 v1.0
# Why this script exists
# ----------------------
# v1.5 and v1.6 were released with the developer's logs/, profiles/ and recordings/
# folders inside the zip — because those releases were hand-zipped from a publish/
# folder the app had been run from, which had accumulated that runtime data, instead
# of using this script. This version removes the human step that went wrong:
# * It ALWAYS publishes into a fresh, empty staging folder — never a reused dir.
# * It then SCANS the staged files AND the finished zip, and ABORTS (deletes the
# zip, exits non-zero) if anything that could carry personal data is present.
# Never hand-zip publish/ again. Run this. If it aborts, the release does not ship.
#
# Produces dist\RemSound-v1.0.zip, ready for `gh release create`. The asset name matches
# what RemSoundUpdater expects on the GitHub Releases page (RemSound-<tag>.zip); change
# RemSoundUpdater.AssetNameTemplate if you rename here.
# Usage:
# powershell -ExecutionPolicy Bypass -File build-release.ps1 -Tag v1.7
#
# The -Tag value must match the GitHub release tag. The zip is named RemSound-<Tag>.zip
# because the in-app updater downloads exactly that asset name (AssetNameTemplate in
# RemSoundUpdater.cs: "RemSound-{tag}.zip").
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, Position=0)]
[Parameter(Mandatory = $true, Position = 0)]
[ValidatePattern('^v[0-9]+\.[0-9]+$')]
[string]$Tag
)
$ErrorActionPreference = 'Stop'
$repoRoot = $PSScriptRoot
Write-Host "Cleaning publish staging..." -ForegroundColor Cyan
$stage = Join-Path $repoRoot 'src\RemSound.App\bin\Release\net10.0-windows\publish'
if (Test-Path $stage) { Remove-Item $stage -Recurse -Force }
$repo = $PSScriptRoot
$proj = Join-Path $repo 'src\RemSound.App\RemSound.App.csproj'
$distDir = Join-Path $repo 'dist'
$zipPath = Join-Path $distDir "RemSound-$Tag.zip"
$staging = Join-Path ([System.IO.Path]::GetTempPath()) ("remsound-release-" + [guid]::NewGuid().ToString('N'))
Write-Host "Publishing framework-dependent..." -ForegroundColor Cyan
& dotnet publish (Join-Path $repoRoot 'src\RemSound.App\RemSound.App.csproj') -c Release | Out-Null
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed (exit $LASTEXITCODE)" }
# Anything matching these must NEVER appear in a release. Folders by name; files by
# extension / exact name. RemSound.deps.json and RemSound.runtimeconfig.json are
# legitimate app files and are deliberately NOT matched (different names).
$forbiddenFolders = @('logs', 'profiles', 'recordings')
function Test-Forbidden([string]$path) {
$p = $path -replace '\\', '/'
foreach ($f in $forbiddenFolders) {
if ($p -match "(^|/)$f/") { return $true }
}
if ($p -match '\.log$') { return $true }
if ($p -match '(^|/)remsound\.config\.json$') { return $true }
return $false
}
$distDir = Join-Path $repoRoot 'dist'
if (-not (Test-Path $distDir)) { New-Item -ItemType Directory -Path $distDir | Out-Null }
# 1. Fresh, empty staging folder — the whole point. The app has never run here, so
# there is nothing to leak.
if (Test-Path $staging) { Remove-Item $staging -Recurse -Force }
New-Item -ItemType Directory -Path $staging -Force | Out-Null
$zipName = "RemSound-$Tag.zip"
$zipPath = Join-Path $distDir $zipName
if (Test-Path $zipPath) { Remove-Item $zipPath -Force }
Write-Host "Publishing $Tag to clean staging: $staging" -ForegroundColor Cyan
& dotnet publish $proj -c Release -o $staging | Out-Null
if ($LASTEXITCODE -ne 0) { Remove-Item $staging -Recurse -Force; throw "dotnet publish failed (exit $LASTEXITCODE)" }
Write-Host "Zipping $zipName..." -ForegroundColor Cyan
Compress-Archive -Path (Join-Path $stage '*') -DestinationPath $zipPath -CompressionLevel Optimal
# 2. Debug symbols are not personal data, but they don't belong in a release either.
Get-ChildItem -Path $staging -Filter *.pdb -Recurse | Remove-Item -Force
# 3. SAFETY CHECK on the staged files.
$bad = @()
Get-ChildItem -Path $staging -Recurse -Force | ForEach-Object {
$rel = $_.FullName.Substring($staging.Length).TrimStart('\', '/')
if (Test-Forbidden $rel) { $bad += $rel }
}
if ($bad.Count -gt 0) {
Write-Host ""
Write-Host "RELEASE ABORTED - staged folder contains files that must not ship:" -ForegroundColor Red
$bad | Sort-Object -Unique | ForEach-Object { Write-Host " $_" -ForegroundColor Red }
Remove-Item $staging -Recurse -Force
exit 1
}
# 4. Zip it. Keep dist/ to a single artefact — drop any prior versioned zip.
New-Item -ItemType Directory -Path $distDir -Force | Out-Null
Get-ChildItem -Path $distDir -Filter 'RemSound-v*.zip' -ErrorAction SilentlyContinue | Remove-Item -Force
Compress-Archive -Path (Join-Path $staging '*') -DestinationPath $zipPath -CompressionLevel Optimal -Force
# 5. SAFETY CHECK again, on the finished zip itself — belt and braces.
Add-Type -AssemblyName System.IO.Compression.FileSystem
$zip = [System.IO.Compression.ZipFile]::OpenRead($zipPath)
try {
$leaked = @($zip.Entries | Where-Object { Test-Forbidden $_.FullName })
$entryCount = $zip.Entries.Count
} finally {
$zip.Dispose()
}
if ($leaked.Count -gt 0) {
Write-Host ""
Write-Host "RELEASE ABORTED - finished zip contains forbidden entries:" -ForegroundColor Red
$leaked | ForEach-Object { Write-Host " $($_.FullName)" -ForegroundColor Red }
Remove-Item $zipPath -Force
Remove-Item $staging -Recurse -Force
exit 1
}
Remove-Item $staging -Recurse -Force
$size = [math]::Round((Get-Item $zipPath).Length / 1MB, 2)
Write-Host ""
Write-Host "Built $zipPath ($size MB)" -ForegroundColor Green
Write-Host "OK - clean release zip verified: $zipPath ($size MB, $entryCount entries)" -ForegroundColor Green
Write-Host " No logs / profiles / recordings / config present." -ForegroundColor Green
Write-Host ""
Write-Host "Next:"
Write-Host " git add -A; git commit -m 'Release $Tag'; git push"
Write-Host " gh release create $Tag $zipPath --title `"$Tag`" --notes-file RELEASE_NOTES.md"
Write-Host "Next:" -ForegroundColor Cyan
Write-Host " gh release create $Tag `"$zipPath`" --title `"RemSound $Tag`" --notes-file RELEASE_NOTES.md"