-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
31 lines (25 loc) · 1017 Bytes
/
build.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
function New-Package($version) {
New-SharedAssemblyInfo $version
dotnet pack --output built /p:PackageVersion="$($version.FullSemVer)" /p:NoPackageAnalysis=true /p:Configuration=Release
}
function New-SharedAssemblyInfo($version) {
$assemblyInfoContent = @"
// <auto-generated/>
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyVersionAttribute("$($version.AssemblyVersion)")]
[assembly: AssemblyFileVersionAttribute("$($version.AssemblyVersion)")]
[assembly: AssemblyInformationalVersionAttribute("$($version.FullSemVer)")]
"@
if (-not (Test-Path "built")) {
New-Item -ItemType Directory "built"
}
$assemblyInfoContent | Out-File -Encoding utf8 (Join-Path "built" "SharedAssemblyInfo.cs") -Force
}
Remove-Item built -Force -Recurse -ErrorAction SilentlyContinue
dotnet clean
dotnet restore
$version = git-flow-version | ConvertFrom-Json
Write-Host "calculated version:"
$version | Format-List
New-Package $version