refactor(build): added back in the build name stuff

This commit is contained in:
2025-07-22 19:59:29 -05:00
parent 52ef39fd5c
commit 92ce51eb7c

View File

@@ -26,10 +26,10 @@ if (Test-Path $envFile) {
Write-Host ".env file not found at $envFile" Write-Host ".env file not found at $envFile"
} }
# if (-not $env:BUILD_NAME) { if (-not $env:BUILD_NAME) {
# Write-Warning "BUILD_NAME environment variable is not set. Please make sure you have entered the correct info the env" Write-Warning "BUILD_NAME environment variable is not set. Please make sure you have entered the correct info the env"
# exit 1 exit 1
# } }
function Get-PackageVersion { function Get-PackageVersion {
param ( param (
@@ -78,7 +78,7 @@ function Update-BuildNumber {
$name = $matches[2] $name = $matches[2]
$newNumber = $number + 1 $newNumber = $number + 1
$newBuildNumber = "$newNumber" $newBuildNumber = "$($newNumber)-$($name)"
Set-Content -Path $buildNumberFile -Value $newBuildNumber Set-Content -Path $buildNumberFile -Value $newBuildNumber
@@ -87,6 +87,7 @@ function Update-BuildNumber {
return $newBuildNumber return $newBuildNumber
} else { } else {
Write-Warning "BUILD_NUMBER file content '$current' is not in the expected 'number-name' format." Write-Warning "BUILD_NUMBER file content '$current' is not in the expected 'number-name' format."
Set-Content -Path $buildNumberFile -Value "1-"$($env:BUILD_NAME)
return $null return $null
} }
} }
@@ -95,6 +96,7 @@ function Update-BuildNumber {
Push-Location $rootDir/backend Push-Location $rootDir/backend
Write-Host "Building the app" Write-Host "Building the app"
go get go get
swag init -o swagger -g main.go
go build -ldflags "-X main.version=$($version)-$($initialBuildValue)" -o lst_app.exe ./main.go go build -ldflags "-X main.version=$($version)-$($initialBuildValue)" -o lst_app.exe ./main.go
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
Write-Warning "app build failed!" Write-Warning "app build failed!"