mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-10-17 05:30:37 +08:00
56e734929f
build.sh and build.ps1 each built the GUI, the core and the service their own way, and nothing in the repository ran them; build.sh passed a with_gvisor tag no source file declares. build.sh now runs the same commands as _build_web.yml and _build_binaries.yml, takes the version as an argument or from git describe, and stops at the first failing step; build.ps1 is the same sequence for PowerShell. release_main.yml and beta_release_main.yml duplicated every release job and had drifted (the beta looked the release up in a hard-coded repository). Both now call _release.yml with the tag, a prerelease flag and whether to publish to the downstream package channels.
48 lines
1.3 KiB
PowerShell
48 lines
1.3 KiB
PowerShell
$ErrorActionPreference = "Stop"
|
|
|
|
$rootDir = $PSScriptRoot
|
|
if ($args.Count -gt 0) {
|
|
$version = $args[0]
|
|
} else {
|
|
$version = (& git -C $rootDir describe --tags --always --dirty).Trim()
|
|
if ($LASTEXITCODE -ne 0) {
|
|
exit $LASTEXITCODE
|
|
}
|
|
}
|
|
$webDir = Join-Path $rootDir "service/server/router/web"
|
|
|
|
& yarn --cwd (Join-Path $rootDir "gui") --check-files
|
|
if ($LASTEXITCODE -ne 0) {
|
|
exit $LASTEXITCODE
|
|
}
|
|
& yarn --cwd (Join-Path $rootDir "gui") build
|
|
if ($LASTEXITCODE -ne 0) {
|
|
exit $LASTEXITCODE
|
|
}
|
|
|
|
Remove-Item -Recurse -Force -ErrorAction Ignore $webDir
|
|
New-Item -ItemType Directory -Force $webDir | Out-Null
|
|
Get-ChildItem -Force (Join-Path $rootDir "web") | Copy-Item -Destination $webDir -Recurse -Force
|
|
|
|
Push-Location (Join-Path $rootDir "core")
|
|
try {
|
|
$env:CGO_ENABLED = "0"
|
|
& go build -trimpath -o (Join-Path $rootDir "v2raya_core.exe") "-ldflags=-X main.Version=$version -s -w" ./main
|
|
if ($LASTEXITCODE -ne 0) {
|
|
exit $LASTEXITCODE
|
|
}
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
|
|
Push-Location (Join-Path $rootDir "service")
|
|
try {
|
|
$env:CGO_ENABLED = "0"
|
|
& go build -trimpath -o (Join-Path $rootDir "v2raya.exe") "-ldflags=-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w"
|
|
if ($LASTEXITCODE -ne 0) {
|
|
exit $LASTEXITCODE
|
|
}
|
|
} finally {
|
|
Pop-Location
|
|
}
|