refactor(builds): refactored how the builds works to include the build number now

this will be for the new lst - ccc
This commit is contained in:
2026-06-17 10:34:53 -05:00
parent 4ff10dfcb2
commit 1b1918dcd0
8 changed files with 192 additions and 152 deletions

View File

@@ -31,24 +31,32 @@ function Update-Server {
[string]$Server,
[string]$Token
)
$buildFile = Join-Path $AppDir ".buildNumber"
$buildFile = Join-Path $AppDir "package.json"
$BuildNumber = 1
$BuildFolder = Join-Path $AppDir "builds"
if (Test-Path $BuildFile) {
$content = Get-Content $BuildFile | Select-Object -First 1
$num = $content.Trim() -as [int] # safe cast
$packageJson = Get-Content $buildFile -Raw | ConvertFrom-Json
# Extract the .build property and cast it safely to an integer
$num = "$($packageJson.version).$(([int]$packageJson.build) -1)"
# if (Test-Path $BuildFile) {
# # Parse the entire JSON file into a PowerShell object
# $packageJson = Get-Content $buildFile -Raw | ConvertFrom-Json
# # Extract the .build property and cast it safely to an integer
# $num = "($packageJson.version).($packageJson.build)"
if ($num) {
$BuildNumber = $num + 1
}
else {
$BuildNumber = 1
}
}
# if ($null -ne $num) {
# $BuildNumber = $num + 1
# }
# else {
# $BuildNumber = 1
# }
# }
# Get The current Build we have zipped up
$BuildNumber = ([int]$BuildNumber - 1).ToString()
$BuildNumber = $num
# copy the latest build over