diff --git a/build.ps1 b/build.ps1 index 548ea4e..d07c2ab 100644 --- a/build.ps1 +++ b/build.ps1 @@ -25,8 +25,14 @@ if (-not $Extension -and -not $Standalone) { } $distDir = Join-Path $repoRoot "dist" +if (Test-Path $distDir) { + Remove-Item -Path (Join-Path $distDir "*") -Recurse -Force +} New-Item -ItemType Directory -Path $distDir -Force | Out-Null +$pkg = Get-Content (Join-Path $repoRoot "package.json") -Raw | ConvertFrom-Json +$version = $pkg.version + function Write-Step($msg) { Write-Host "" Write-Host "==> $msg" -ForegroundColor Cyan @@ -104,13 +110,14 @@ if ($Standalone) { } } - $exeOut = Join-Path $distDir "hpl-toolbox.exe" + $exeName = "hpl-toolbox-$version.exe" + $exeOut = Join-Path $distDir $exeName go build -ldflags="-s -w -H windowsgui" -trimpath -o $exeOut . if ($LASTEXITCODE -ne 0) { Write-Error "go build failed"; exit 1 } $summary += [pscustomobject]@{ - Artifact = "hpl-toolbox.exe" - Path = "dist\hpl-toolbox.exe" + Artifact = $exeName + Path = "dist\$exeName" Size = Get-FileSize $exeOut } } finally { diff --git a/dist/hpl-toolbox.exe b/dist/hpl-toolbox-0.1.3.exe similarity index 100% rename from dist/hpl-toolbox.exe rename to dist/hpl-toolbox-0.1.3.exe