-
Notifications
You must be signed in to change notification settings - Fork 1
/
appveyor-prebuild.ps1
33 lines (26 loc) · 1.04 KB
/
appveyor-prebuild.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
Write-Host "prebuild: Executing prebuild script"
Push-Location $PSScriptRoot
if (Test-Path .\artifacts)
{
Write-Host "prebuild: Cleaning .\artifacts"
Remove-Item .\artifacts -Force -Recurse
}
Write-Host "prebuild: Setting version numbers"
# OtpCore
$ProjectFile = (Join-Path $PSScriptRoot "OtpCore\OtpCore.csproj")
$PackageCodeMarker = "9999.9999.9999"
$AssemblyCodeMarker = "9999.9999.9999.9999"
$PackageVersion = "$($env:APPVEYOR_BUILD_VERSION)"
if (($PackageVersion.Split("-"))[1] -eq "release")
{
# Set package version to three digit release number for actual releases
$PackageVersion = "$(($PackageVersion.Split("-"))[0])"
}
$AssemblyVersion = "$(($PackageVersion.Split("-"))[0]).0"
# OtpCore
(Get-Content $ProjectFile -Raw).replace($AssemblyCodeMarker, $AssemblyVersion) | Set-Content -Encoding UTF8 $ProjectFile
(Get-Content $ProjectFile -Raw).replace($PackageCodeMarker, $PackageVersion) | Set-Content -Encoding UTF8 $ProjectFile
Write-Host "prebuild: Restoring packages"
& dotnet restore --no-cache
& nuget restore -Force
Pop-Location