29 lines
2.0 KiB
PowerShell
29 lines
2.0 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
$projectRoot = [IO.Path]::GetFullPath('C:\wechat_rpa')
|
|
$artifactRoot = [IO.Path]::GetFullPath('C:\kefu\deploy\review-badges-20260917')
|
|
$buildPython = Join-Path $projectRoot '.build-venv\Scripts\python.exe'
|
|
$appDir = Join-Path $projectRoot 'dist\ZhenAI-WeCom-Assistant-v1.4.19'
|
|
if (Test-Path -LiteralPath $appDir) { throw 'Expected a new v1.4.19 output directory' }
|
|
$sourceNames = @('gui_runtime.py','wechat_bot.py','wecom_native_sender.py','wechat_gui_qt.py','protocol_engine.py','wxwork_protocol_probe.py','app_version.py','review_policy.py','review_state.py','assets/ui/console-review.css','assets/ui/console-app.js','assets/ui/zhenyang-ai-console.html')
|
|
$manifest = [ordered]@{}
|
|
foreach ($name in $sourceNames) {
|
|
$manifest[$name] = (Get-FileHash -LiteralPath (Join-Path $projectRoot $name) -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
}
|
|
[IO.File]::WriteAllText((Join-Path $artifactRoot 'build-source-manifest.json'), ($manifest | ConvertTo-Json), [Text.UTF8Encoding]::new($false))
|
|
$env:LOCALAPPDATA = Join-Path $artifactRoot 'build-self-check-profile\Local'
|
|
$env:APPDATA = Join-Path $artifactRoot 'build-self-check-profile\Roaming'
|
|
New-Item -ItemType Directory -Path $env:LOCALAPPDATA,$env:APPDATA -Force | Out-Null
|
|
Push-Location $projectRoot
|
|
try {
|
|
& (Join-Path $projectRoot 'build_windows_exe.ps1') -PythonPath $buildPython *> (Join-Path $artifactRoot 'app-build.log')
|
|
if ($LASTEXITCODE -ne 0) { throw 'Application build returned failure' }
|
|
foreach ($name in $sourceNames) {
|
|
$actual = (Get-FileHash -LiteralPath (Join-Path $projectRoot $name) -Algorithm SHA256).Hash.ToLowerInvariant()
|
|
if ($actual -ne $manifest[$name]) { throw ('Source changed during build: ' + $name) }
|
|
}
|
|
& (Join-Path $projectRoot 'build_installer.ps1') -SkipAppBuild *> (Join-Path $artifactRoot 'installer-build.log')
|
|
if ($LASTEXITCODE -ne 0) { throw 'Installer build returned failure' }
|
|
Write-Output 'Application and installer build completed with production self-check.'
|
|
}
|
|
finally { Pop-Location }
|