2
0
mirror of https://github.com/Alia5/GlosSI.git synced 2024-11-07 03:20:35 +00:00
GlosSI/version_help.ps1
Peter Repukat cf7ad3752a Update version_help.ps1
Also update installer script if present
2022-06-16 22:20:43 +02:00

15 lines
1.0 KiB
PowerShell

$tag = git describe --tags --always
if (-Not ($tag -match ".+\..+\..+\..+")) {
$tag = "0.0.0." + $tag
}
$commatag = $tag -replace "\.",","
$commatag = $commatag -replace "-","0"
$commatag = $commatag -replace "[A-z]","0"
((Get-Content -path ./Resource.rc -Raw) -replace "FILEVERSION .*,.*,.*,.*", ("FILEVERSION " + $commatag)) | Set-Content -Path ./Resource.rc
((Get-Content -path ./Resource.rc -Raw) -replace "PRODUCTVERSION .*,.*,.*,.*", ("PRODUCTVERSION " + $commatag)) | Set-Content -Path ./Resource.rc
((Get-Content -path ./Resource.rc -Raw) -replace '"FileVersion", ".*"', ('"FileVersion", "' + $tag + '"')) | Set-Content -Path ./Resource.rc
((Get-Content -path ./Resource.rc -Raw) -replace '"ProductVersion", ".*"', ('"ProductVersion", "' + $tag + '"')) | Set-Content -Path ./Resource.rc
if ((Test-Path '../Installer/Installer.nsi')) {
((Get-Content -path '../Installer/Installer.nsi' -Raw) -replace '!define VERSION ".*"', ('!define VERSION "' + $tag + '"')) | Set-Content -Path '../Installer/Installer.nsi'
}