-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.ps1
More file actions
71 lines (48 loc) · 1.94 KB
/
Copy pathdefault.ps1
File metadata and controls
71 lines (48 loc) · 1.94 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#globals
$GIT_VERSION = Join-Path $TOOLS_DIR GitVersion.CommandLine\tools\GitVersion.exe
$TEMP_DIR = "$BuildRoot\temp"
$ARTIFACTS_DIR = "$BuildRoot\artifacts"
Set-Alias GitVersion ($GIT_VERSION)
#tasks
task Restore -If {$SkipPackageRestore -eq $false} {
exec { & dotnet restore }
}
task Version {
$versionJson = exec { GitVersion } | Out-String
$script:Version = ConvertFrom-Json $versionJson
$buildNumber = $script:Version.FullSemVer + ".build." + $env:APPVEYOR_BUILD_NUMBER
$script:buildNumber = $buildNumber
$env:branchName = $script:Version.BranchName
}, PublishVersion
task Clean {
exec { & dotnet clean }
rm $TEMP_DIR -Recurse -Force -ErrorAction 0
rm $ARTIFACTS_DIR -Recurse -Force -ErrorAction 0
mkdir $TEMP_DIR -Force | Out-Null
mkdir $ARTIFACTS_DIR -Force | Out-Null
}
task Build Version, Restore, Clean, {
$AssemblySemFileVer = $script:Version.AssemblySemFileVer
$AssemblySemVer = $script:Version.AssemblySemVer
$InformationalVersion = $script:Version.InformationalVersion
exec { & dotnet build -v $Verbosity -c $Configuration --no-restore /p:AssemblyVersion=$AssemblySemVer /p:FileVersion=$AssemblySemFileVer /p:InformationalVersion=$InformationalVersion}
}
task Pack Build, {
$packageVersion = $script:Version.FullSemVer
$script:packageVersion = $packageVersion
exec { & dotnet pack src\Dbc --no-build --no-restore --output "$ARTIFACTS_DIR\lib" /p:PackageVersion=$script:packageVersion /p:NoPackageAnalysis=true -c $Configuration}
}
task Push -If $env:APPVEYOR {
if($env:branchName -like "master") {
Get-Item "$ARTIFACTS_DIR\lib\*.nupkg" | % {
$path = $_.FullName
exec { Nuget push $_.FullName $env:Nuget_Api_Key -Source $env:Nuget_Feed_Push }
}
}
}
task Release Push -If $env:APPVEYOR
task CI Pack, Release
task default Build
task PublishVersion -If $env:APPVEYOR {
Update-AppveyorBuild -Version $script:buildNumber
}