Local checkpoint - NOT for public release. Two gaps found reviewing the publish/release scripts: - deploy-test.ps1: the binary sync (publish -> D:\Dropbox\remsound) used /E with no /MIR, so it never DELETES user data - but it could OVERWRITE it if publish\ ever accumulated a "user settings and logs" folder. Added /XD/'user settings and logs','recordings','logs', 'profiles','config' + /XF 'global config.json','remsound.config.json' so the binary sync is physically incapable of touching Ed's profiles/logs/config in either direction. Test deploys keep ALL of his data current, by construction. - build-release.ps1: never checked the -Tag against the csproj <Version>. A mismatch ships RemSound-<tag>.zip containing a different version's binary, which the in-app updater (it downloads by tag name) reads as a perpetual "update available". Now aborts up front if tag != csproj <Version> - also catches a forgotten version bump. The intended split was already correct: test deploy keeps everything; build-release publishes to a fresh folder, strips pdb, and scans staged files AND the zip for any profiles/logs/config/recordings, aborting if found. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
72 lines
4.3 KiB
PowerShell
72 lines
4.3 KiB
PowerShell
# deploy-test.ps1 - Ed's test-deploy. proj\remsound\default sounds is the AUTHORITATIVE sound master.
|
|
#
|
|
# As of 2026-06-13 the shipped DEFAULT cue sounds live in a "default sounds\" folder next to the exe
|
|
# (AppConfig.SoundsDirectory) - they're part of the install, not per-user state, so an update (or a
|
|
# republish) always overwrites them and a tweaked default always lands. The user's OWN custom sounds
|
|
# are NOT here: they're explicit file paths set via the Preferences "Browse" picker, kept in the
|
|
# user's own location, which nothing here touches.
|
|
#
|
|
# Every run of THIS script force-copies the ENTIRE source "default sounds\" folder over BOTH test
|
|
# locations' copies, overwriting every file regardless of timestamp/size (/IS /IT). Ed can tweak any
|
|
# number of sounds, with any timestamps, without telling anyone which changed - the next deploy
|
|
# always takes them all. (A running app reads each WAV fresh on every play, so a sound tweak even
|
|
# takes effect live, no restart needed.) Binaries + program files go out too, skipped automatically
|
|
# if RemSound is open and has them locked.
|
|
#
|
|
# Run: powershell -ExecutionPolicy Bypass -File deploy-test.ps1
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$repo = $PSScriptRoot
|
|
$proj = Join-Path $repo 'src\RemSound.App\RemSound.App.csproj'
|
|
$srcSounds = Join-Path $repo 'default sounds'
|
|
$publish = Join-Path $repo 'publish'
|
|
|
|
# The TWO test run-locations. Each has its own 'default sounds\' copy that must be kept current.
|
|
$runLocations = @($publish, 'D:\Dropbox\remsound')
|
|
|
|
function Invoke-Robocopy([string[]]$rcArgs) {
|
|
& robocopy @rcArgs /NFL /NDL /NJH /NJS /NP /R:3 /W:1 | Out-Null
|
|
if ($LASTEXITCODE -ge 8) { throw "robocopy failed ($LASTEXITCODE): $($rcArgs -join ' ')" }
|
|
}
|
|
|
|
$soundOnly = @(Get-Process RemSound -ErrorAction SilentlyContinue).Count -gt 0
|
|
if ($soundOnly) {
|
|
Write-Host "RemSound is running - refreshing SOUNDS only (binaries are locked; close RemSound to update them)." -ForegroundColor Yellow
|
|
}
|
|
else {
|
|
Write-Host "Publishing (Release) -> $publish ..." -ForegroundColor Cyan
|
|
& dotnet publish $proj -c Release -o $publish --nologo -v q
|
|
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed ($LASTEXITCODE)" }
|
|
}
|
|
|
|
foreach ($loc in $runLocations) {
|
|
# Binaries: publish\ already has them from the publish above; copy them to the other location(s).
|
|
if (-not $soundOnly -and $loc -ne $publish) {
|
|
Write-Host "Deploying program + binaries -> $loc (preserving user settings/logs) ..." -ForegroundColor Cyan
|
|
# /E copies the program + binaries; NO /MIR so we never DELETE the user's data. The /XD
|
|
# excludes make the copy incapable of OVERWRITING it either: if publish\ ever accumulated a
|
|
# user-data folder (a stray run from there), it must never land on Ed's real Dropbox profiles/
|
|
# config/logs. The binary sync only ever carries program files, never user state, both ways.
|
|
Invoke-Robocopy @($publish, $loc, '/E',
|
|
'/XD', 'user settings and logs', 'recordings', 'logs', 'profiles', 'config',
|
|
'/XF', 'global config.json', 'remsound.config.json')
|
|
}
|
|
# THE point of this script: the whole source 'default sounds' folder, force-copied over THIS
|
|
# location's copy, every time. /IS = copy even files robocopy thinks are identical; /IT = copy
|
|
# "tweaked" files. No /XO (don't skip on timestamp) and no /MIR (don't delete files).
|
|
$locSounds = Join-Path $loc 'default sounds'
|
|
Write-Host "Force-syncing 'default sounds' -> $locSounds (source wins, every time) ..." -ForegroundColor Cyan
|
|
New-Item -ItemType Directory -Path $locSounds -Force | Out-Null
|
|
Invoke-Robocopy @($srcSounds, $locSounds, '*.wav', '/IS', '/IT')
|
|
|
|
# One-time tidy: drop the orphaned pre-2026-06-13 program 'sounds\' folder and the defunct old
|
|
# per-user sounds folder if they're lingering from before the move (the running app also deletes
|
|
# the per-user one on launch). Idempotent - a no-op once gone.
|
|
foreach ($orphan in @((Join-Path $loc 'sounds'), (Join-Path $loc 'user settings and logs\sounds'))) {
|
|
if (Test-Path -LiteralPath $orphan) { Remove-Item -LiteralPath $orphan -Recurse -Force -ErrorAction SilentlyContinue }
|
|
}
|
|
}
|
|
|
|
$count = @(Get-ChildItem $srcSounds -Filter *.wav).Count
|
|
Write-Host "Done. $count default sounds force-synced to BOTH test locations. Tweak away - the next run always takes them all." -ForegroundColor Green
|