-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathupdate_version.ps1
More file actions
31 lines (25 loc) · 887 Bytes
/
update_version.ps1
File metadata and controls
31 lines (25 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Run dotnet-gitversion and parse the JSON output
$GitVersion = dotnet-gitversion | ConvertFrom-Json
# Extract version components
$Major = $GitVersion.Major
$Minor = $GitVersion.Minor
$Patch = $GitVersion.Patch
$SemVer = $GitVersion.SemVer
$CopyrightYear = (Get-Date).Year
# Format the VERSION_NUMBER and VERSION_STRING
$VersionNumber = "$Major,$Minor,$Patch,0"
$VersionString = "$Major.$Minor.$Patch.0"
# Define the updated version.h content
$HeaderContent = @"
#define VLDVERSION L"$SemVer"
#define VERSION_NUMBER $VersionNumber
#define VERSION_STRING "$VersionString"
#define VERSION_COPYRIGHT "Copyright (C) 2005-$CopyrightYear"
#ifndef __FILE__
!define VLD_VERSION "$SemVer" // NSIS Script
#endif
"@
# Update the version.h file
$HeaderFilePath = "setup\version.h"
Set-Content -Path $HeaderFilePath -Value $HeaderContent
Write-Host "version.h updated successfully."