feat: complete 2.0.7.12 platform overhaul
This commit is contained in:
@@ -7,6 +7,15 @@ param(
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Root = Resolve-Path (Join-Path $PSScriptRoot "..")
|
||||
$Out = Join-Path $Root $OutDir
|
||||
$ExistingAdminMetadata = Join-Path $Root "web\admin\dist\admin-build.json"
|
||||
$AdminBuildId = if ($env:YMHUT_ADMIN_BUILD_ID) {
|
||||
$env:YMHUT_ADMIN_BUILD_ID
|
||||
} elseif ($SkipFrontend -and (Test-Path $ExistingAdminMetadata)) {
|
||||
(Get-Content $ExistingAdminMetadata -Raw | ConvertFrom-Json).buildId
|
||||
} else {
|
||||
"$Version-$([DateTimeOffset]::UtcNow.ToUnixTimeSeconds())"
|
||||
}
|
||||
$env:YMHUT_ADMIN_BUILD_ID = $AdminBuildId
|
||||
$env:GOPROXY = if ($env:YMHUT_GOPROXY) { $env:YMHUT_GOPROXY } elseif ($env:GOPROXY) { $env:GOPROXY } else { "https://goproxy.io,https://mirrors.aliyun.com/goproxy,direct" }
|
||||
|
||||
function Run-Step {
|
||||
@@ -39,6 +48,8 @@ if (-not $SkipFrontend) {
|
||||
}
|
||||
}
|
||||
|
||||
Run-Step (Join-Path $Root "web\admin") "npm" @("run", "validate:build")
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $Out | Out-Null
|
||||
|
||||
function Copy-IfExists {
|
||||
@@ -79,7 +90,7 @@ foreach ($Target in $Targets) {
|
||||
$env:GOARCH = $Target.GOARCH
|
||||
$env:CGO_ENABLED = "0"
|
||||
$Output = Join-Path $Out $Target.Name
|
||||
Run-Step $Root "go" @("build", "-tags", "embed_web", "-buildvcs=false", "-trimpath", "-ldflags", "-s -w -X ymhut-box/server/unified-management/internal/config.Version=$Version", "-o", $Output, ".\cmd\unified-management")
|
||||
Run-Step $Root "go" @("build", "-tags", "embed_web", "-buildvcs=false", "-trimpath", "-ldflags", "-s -w -X ymhut-box/server/unified-management/internal/config.Version=$Version -X ymhut-box/server/unified-management/internal/config.AdminBuildID=$AdminBuildId", "-o", $Output, ".\cmd\unified-management")
|
||||
}
|
||||
|
||||
Remove-Item Env:\GOOS -ErrorAction SilentlyContinue
|
||||
|
||||
Reference in New Issue
Block a user