Get-VersionInfo.ps1 741 B

1234567891011121314151617181920
  1. # Get-VersionInfo.ps1
  2. # Load Directory.Build.props as an XML
  3. [xml]$xml = Get-Content "$PSScriptRoot/../src/Directory.Build.props"
  4. # Extract VersionPrefix, VersionSuffix, and FileVersion
  5. $versionPrefix = $xml.Project.PropertyGroup.VersionPrefix
  6. $versionSuffix = $xml.Project.PropertyGroup.VersionSuffix
  7. $fileVersion = $xml.Project.PropertyGroup.FileVersion
  8. # Combine VersionPrefix and VersionSuffix
  9. $fullVersion = "$versionPrefix-$versionSuffix"
  10. # Replace double dashes with a single dash
  11. $fullVersion = $fullVersion -replace '--', '-'
  12. $fileVersion = $fileVersion -replace '--', '-'
  13. # Output the results for GitHub Actions
  14. Write-Output "::set-output name=version::$fullVersion"
  15. Write-Output "::set-output name=file-version::$fileVersion"