Smail/deploy/build.ps1
smail f60d3b0880
Some checks are pending
Security Checks / security (push) Waiting to run
整理前后端与测试构建目录并完善配置和安全引导
统一 frontend、backend、test、test-log 和 out 目录,更新构建、部署及测试入口;纳入配置管理兼容与首次安全引导修复;排除本机配置、密钥和测试产物。
2026-09-05 19:19:52 +08:00

24 lines
1014 B
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

param([switch]$SkipFrontend)
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$output = Join-Path $root 'out\backend'
New-Item -ItemType Directory -Path $output -Force | Out-Null
if (-not $SkipFrontend) {
Push-Location (Join-Path $root 'frontend')
try {
& npm.cmd run build
if ($LASTEXITCODE -ne 0) { throw '前端构建失败' }
} finally { Pop-Location }
}
Push-Location (Join-Path $root 'backend')
try {
& go build -o (Join-Path $output 'smail-dev.exe') .
if ($LASTEXITCODE -ne 0) { throw '开发后端构建失败' }
& go build -o (Join-Path $output 'smail-admin.exe') ./cmd/smail-admin
if ($LASTEXITCODE -ne 0) { throw '管理工具构建失败' }
& go build -o (Join-Path $output 'smail-config.exe') ./cmd/smail-config
if ($LASTEXITCODE -ne 0) { throw '配置工具构建失败' }
} finally { Pop-Location }
Write-Output '构建完成:out/frontend 和 out/backend。正式发行请使用 Makefile 的跨平台构建目标。'