-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuildRelease.ps1
More file actions
33 lines (27 loc) · 1.13 KB
/
BuildRelease.ps1
File metadata and controls
33 lines (27 loc) · 1.13 KB
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
32
# Script for building and packaging versioned releases of this project.
# Run from "Developer PowerShell for VS 2022" from a commit with a git tag.
# stop script on first error
$ErrorActionPreference = "Stop"
$p = Start-Process -FilePath "git.exe" -ArgumentList "tag --points-at HEAD" -NoNewWindow -Wait -RedirectStandardOutput "tagname.txt"
$tagname = Get-Content -Path "tagname.txt"
if ($tagname -eq $null) {
throw "No git tag found for current commit"
}
$ver_tokens = $tagname.Split(".")
while ($ver_tokens.Count -le 4) {
$ver_tokens += "0" # set patch & build to 0 if unspecified
}
$MajorVer = $ver_tokens[0].Substring(1) # remove "v" prefix
$MinorVer = $ver_tokens[1]
$PatchVer = $ver_tokens[2]
$BuildVer = $ver_tokens[3]
# Restore NuGet packages
msbuild /nologo /verbosity:minimal /target:restore WebClient.sln
if ($LastExitCode -ne 0) {
throw "msbuild failure"
}
# Build solution in Release for x64
msbuild /nologo /verbosity:minimal /property:Configuration="Release"`;Platform="x64"`;MajorVer=$MajorVer`;MinorVer=$MinorVer`;PatchVer=$PatchVer`;BuildVer=$BuildVer WebClient.sln
if ($LastExitCode -ne 0) {
throw "msbuild failure"
}