Get-BuildVersion

September 18, 2025 ยท View on GitHub

Gets version string from file.

Syntax

Get-BuildVersion [-Path] String [-Regex] Object

Description

It finds the first file line matching Regex and returns its first capturing
group string.

Parameters

-Path
    The file with version strings, like change log, release notes, etc.
    
    Required?                    true
    Position?                    0
-Regex
    [string] or [regex] defining version as its first capturing group.
    
    Required?                    true
    Position?                    1

Outputs

String

Examples

-------------------------- EXAMPLE 1 --------------------------
# Get version from file
Get-BuildVersion Release-Notes.md '##\s+v(\d+\.\d+\.\d+)'