-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReplaceVersion-SignalR.ps1
33 lines (26 loc) · 1.25 KB
/
ReplaceVersion-SignalR.ps1
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
33
param (
)
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12
$year = [System.DateTime]::Now.Year
$BuildMajor = ([int]$env:BUILD_MAJOR)
$BuildMinor = ([int]$env:BUILD_MINOR)
$BuildNumber = ([int]$env:BUILD_NUMBER_SIGNALR) + 1
Invoke-WebRequest "https://gitlab.com/api/v4/projects/$($env:CI_PROJECT_ID)/variables/BUILD_NUMBER_SIGNALR" -Headers @{"PRIVATE-TOKEN"=$env:CI_API_TOKEN} -Body @{value=$BuildNumber} -ContentType "application/x-www-form-urlencoded" -Method "PUT" -UseBasicParsing
$appVer = '{0}.{1}.{2}' -f $BuildMajor, $BuildMinor, $BuildNumber
$copyright = 'Copyright © EllipticBit, LLC. {0}, All Rights Reserved.' -f $year
Get-ChildItem -Path .\SignalR\ -Filter *.csproj -Recurse -File | ForEach-Object {
[string]$filename = $_.FullName
[xml]$filexml = Get-Content -Path $_.FullName -Encoding UTF8
Try
{
$filexml.Project.PropertyGroup.Copyright = $copyright
$filexml.Project.PropertyGroup.Version = $appVer
$filexml.Project.PropertyGroup.FileVersion = $appVer
}
Catch
{
Write-Host "No Version or FileVersion properties found in project: $($filename)"
}
$filexml.InnerXml | Out-File $_.FullName -Encoding UTF8
}
Write-Host "Build Version: $($appVer)"