AstroFrame/packaging/Set-Version.ps1
Elijah 4e6d21de5a
Some checks are pending
Release AstroFrame / packages (push) Waiting to run
Automate Windows and Linux releases with Forgejo Actions
2026-10-03 19:31:43 -07:00

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."