Files
mail-hub/scripts/package_windows.ps1
T

27 lines
961 B
PowerShell
Raw Normal View History

# Windows 打包脚本:构建 release exe 并复制到 dist/
# 用法: powershell -ExecutionPolicy Bypass -File scripts/package_windows.ps1
$ErrorActionPreference = "Stop"
Write-Host "=== MailHub Windows 打包 ===" -ForegroundColor Cyan
# 1. 构建
Write-Host "[1/3] flutter build windows --release ..."
flutter build windows --release
if ($LASTEXITCODE -ne 0) { throw "构建失败" }
# 2. 收集产物
$src = "build\windows\x64\runner\Release"
$dist = "dist\windows"
if (Test-Path $dist) { Remove-Item $dist -Recurse -Force }
New-Item -ItemType Directory -Path $dist -Force | Out-Null
Copy-Item "$src\*" $dist -Recurse -Force
# 3. 打 zip
$zip = "dist\MailHub-windows-x64.zip"
if (Test-Path $zip) { Remove-Item $zip -Force }
Compress-Archive -Path "$dist\*" -DestinationPath $zip
Write-Host "[2/3] 完成: $dist" -ForegroundColor Green
Write-Host "[3/3] 压缩包: $zip" -ForegroundColor Green
Write-Host "=== 打包完成 ===" -ForegroundColor Cyan