mirror of
https://gitee.com/xiarenalofs/squad-rain-ops-mini.git
synced 2026-08-13 07:55:41 +08:00
Initial commit: add RainOpsMini project and documentation
This commit is contained in:
32
UpdateVersion.ps1
Normal file
32
UpdateVersion.ps1
Normal file
@@ -0,0 +1,32 @@
|
||||
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
|
||||
Reference in New Issue
Block a user