8 lines
665 B
PowerShell
8 lines
665 B
PowerShell
param([Parameter(Mandatory)][ValidatePattern('^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$')][string]$Version)
|
|
$ErrorActionPreference = 'Stop'
|
|
$path = Join-Path (Split-Path $PSScriptRoot) 'Directory.Build.props'
|
|
$content = Get-Content -LiteralPath $path -Raw
|
|
if ([regex]::Matches($content, '<Version>[^<]+</Version>').Count -ne 1) { throw 'Expected one Version in Directory.Build.props.' }
|
|
$content = [regex]::Replace($content, '<Version>[^<]+</Version>', "<Version>$Version</Version>")
|
|
[IO.File]::WriteAllText($path, $content)
|
|
Write-Output "AstroFrame version set to $Version. Commit and push the source, then push tag v$Version to build and publish automatically."
|