mirror of
https://gitee.com/xiarenalofs/squad-rain-ops-mini.git
synced 2026-08-04 20:46:33 +08:00
33 lines
615 B
PowerShell
33 lines
615 B
PowerShell
param(
|
|
[string]$ProjectDir = $PSScriptRoot
|
|
)
|
|
|
|
$versionFile = Join-Path $ProjectDir "version.txt"
|
|
|
|
if (-not (Test-Path $versionFile)) {
|
|
"1.0.0.0" | Out-File -Encoding utf8 $versionFile
|
|
}
|
|
|
|
$version = Get-Content $versionFile -Raw
|
|
if ($null -eq $version) {
|
|
$version = "1.0.0.0"
|
|
}
|
|
$version = $version.Trim()
|
|
$parts = $version.Split('.')
|
|
|
|
if ($parts.Length -lt 4) {
|
|
$parts = @(1, 0, 0, 0)
|
|
}
|
|
|
|
# 递增最后一位 (Revision)
|
|
try {
|
|
$parts[3] = [int]$parts[3] + 1
|
|
} catch {
|
|
$parts[3] = 0
|
|
}
|
|
|
|
$newVersion = $parts -join "."
|
|
$newVersion | Out-File -Encoding utf8 $versionFile
|
|
|
|
Write-Output $newVersion
|