# ============================================================================== # ClassNotify P1 RC1 Release Candidate 0 Build Script # Clean builds all production artifacts and computes cryptographic SHA256 hashes # ============================================================================== $ErrorActionPreference = "Stop" $dotnet = "C:\Program Files\dotnet\dotnet.exe" $root = $PSScriptRoot Write-Host "==========================================================" -ForegroundColor Cyan Write-Host " ClassNotify P1 RC1 Clean Build & Hash Calculation " -ForegroundColor Cyan Write-Host "==========================================================" -ForegroundColor Cyan $rcDir = Join-Path $root "rc_artifacts" if (Test-Path $rcDir) { Remove-Item $rcDir -Recurse -Force } New-Item -ItemType Directory -Path $rcDir -Force | Out-Null # 1. Build Web Production Assets Write-Host "`n[1/4] Building Web Production Build (Vite/React)..." -ForegroundColor Yellow $webDir = Join-Path $root "src\Web\ClassNotify.Web" Push-Location $webDir try { npm run build if ($LASTEXITCODE -ne 0) { throw "Web build failed" } } finally { Pop-Location } $wwwrootDir = Join-Path $root "src\Server\ClassNotify.Server\wwwroot" $webZip = Join-Path $rcDir "ClassNotify.Web-assets.zip" Compress-Archive -Path "$wwwrootDir\*" -DestinationPath $webZip -CompressionLevel Optimal $webHash = (Get-FileHash -Path $webZip -Algorithm SHA256).Hash.ToUpper() $webSizeMb = [math]::Round((Get-Item $webZip).Length / 1MB, 2) Write-Host " Web assets packaged: $webZip ($webSizeMb MB)" -ForegroundColor Green Write-Host " SHA256: $webHash" -ForegroundColor Green # 2. Build Server (linux-arm64 self-contained production tarball) Write-Host "`n[2/4] Building ClassNotify.Server (linux-arm64, self-contained)..." -ForegroundColor Yellow $serverPublishDir = Join-Path $root "rc_staging_server" if (Test-Path $serverPublishDir) { Remove-Item $serverPublishDir -Recurse -Force } & $dotnet publish "$root\src\Server\ClassNotify.Server\ClassNotify.Server.csproj" ` -c Release ` -r linux-arm64 ` --self-contained true ` -o $serverPublishDir if ($LASTEXITCODE -ne 0) { throw "Server publish failed" } $serverTarGz = Join-Path $rcDir "ClassNotify.Server-linux-arm64.tar.gz" Push-Location $serverPublishDir try { tar -czf $serverTarGz * } finally { Pop-Location } Remove-Item $serverPublishDir -Recurse -Force $serverHash = (Get-FileHash -Path $serverTarGz -Algorithm SHA256).Hash.ToUpper() $serverSizeMb = [math]::Round((Get-Item $serverTarGz).Length / 1MB, 2) Write-Host " Server tarball created: $serverTarGz ($serverSizeMb MB)" -ForegroundColor Green Write-Host " SHA256: $serverHash" -ForegroundColor Green # 3. Build Windows Installer (ClassNotifySetup.exe) & Windows Binaries Write-Host "`n[3/4] Building Windows Installer & Binaries via build_installer.ps1..." -ForegroundColor Yellow & "$root\build_installer.ps1" if ($LASTEXITCODE -ne 0) { throw "Installer build failed" } $distSetup = Join-Path $root "dist\ClassNotifySetup.exe" $rcSetup = Join-Path $rcDir "ClassNotifySetup.exe" Copy-Item $distSetup $rcSetup -Force $setupHash = (Get-FileHash -Path $rcSetup -Algorithm SHA256).Hash.ToUpper() $setupSizeMb = [math]::Round((Get-Item $rcSetup).Length / 1MB, 2) Write-Host " Windows Installer created: $rcSetup ($setupSizeMb MB)" -ForegroundColor Green Write-Host " SHA256: $setupHash" -ForegroundColor Green # Also copy staged Service and Client for hash records $serviceDll = Join-Path $root "staging\service\ClassNotify.Service.dll" $serviceExe = Join-Path $root "staging\service\ClassNotify.Service.exe" $clientDll = Join-Path $root "staging\client\ClassNotify.Client.dll" $clientExe = Join-Path $root "staging\client\ClassNotify.Client.exe" $serviceExeHash = (Get-FileHash -Path $serviceExe -Algorithm SHA256).Hash.ToUpper() $serviceDllHash = (Get-FileHash -Path $serviceDll -Algorithm SHA256).Hash.ToUpper() $clientExeHash = (Get-FileHash -Path $clientExe -Algorithm SHA256).Hash.ToUpper() $clientDllHash = (Get-FileHash -Path $clientDll -Algorithm SHA256).Hash.ToUpper() # 4. Summary Output Write-Host "`n==========================================================" -ForegroundColor Cyan Write-Host " ClassNotify P1 RC1 Artifacts Manifest " -ForegroundColor Cyan Write-Host "==========================================================" -ForegroundColor Cyan Write-Host "Windows Setup: $rcSetup" Write-Host " SHA256: $setupHash ($setupSizeMb MB)" Write-Host "Windows Service Exe: $serviceExe" Write-Host " SHA256: $serviceExeHash" Write-Host "Windows Client Exe: $clientExe" Write-Host " SHA256: $clientExeHash" Write-Host "Linux Server Tarball: $serverTarGz" Write-Host " SHA256: $serverHash ($serverSizeMb MB)" Write-Host "Web Assets Package: $webZip" Write-Host " SHA256: $webHash ($webSizeMb MB)" Write-Host "==========================================================" -ForegroundColor Cyan # Save JSON manifest for scripting $manifestObj = [ordered]@{ Candidate = "ClassNotify P1 RC1" Timestamp = (Get-Date).ToString("o") Artifacts = [ordered]@{ "ClassNotifySetup.exe" = @{ Path = $rcSetup SizeMb = $setupSizeMb Sha256 = $setupHash } "ClassNotify.Service.exe" = @{ Sha256 = $serviceExeHash } "ClassNotify.Client.exe" = @{ Sha256 = $clientExeHash } "ClassNotify.Server-linux-arm64.tar.gz" = @{ Path = $serverTarGz SizeMb = $serverSizeMb Sha256 = $serverHash } "ClassNotify.Web-assets.zip" = @{ Path = $webZip SizeMb = $webSizeMb Sha256 = $webHash } } } $manifestJsonPath = Join-Path $rcDir "rc_manifest.json" $manifestObj | ConvertTo-Json -Depth 5 | Set-Content -Path $manifestJsonPath -Encoding utf8 Write-Host "`nManifest saved to: $manifestJsonPath" -ForegroundColor Green