forked from thomasgalliker/EFCore.Toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.yml
118 lines (90 loc) · 2.62 KB
/
build.yml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
####################################################################
# VSTS Build Configuration
#
# (c)2018 superdev GmbH
####################################################################
name: 2.0.$(date:yy)$(DayOfYear).$(rev:rr)
queue:
name: Hosted VS2017
demands:
- msbuild
- visualstudio
- vstest
trigger:
- master
- develop
- release/*
steps:
- task: bleddynrichards.Assembly-Info-Task.Assembly-Info-Task.Assembly-Info-Task@1
displayName: 'Set Assembly Manifest Data'
inputs:
FileNames: |
$(Parameters.csproj)
InsertAttributes: true
VersionNumber: '$(Build.BuildNumber)'
FileVersionNumber: '$(Build.BuildNumber)'
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
- powershell: |
$branch1="develop"
$branch2="master"
[String]$buildNumber= $Env:BUILD_BUILDNUMBER
[String]$rev = $buildNumber.Substring($buildNumber.LastIndexOf('.') + 1)
echo "rev=$rev"
if ("$(Build.SourceBranchName)" -eq $branch1)
{
echo "the build is on $branch1"
Write-Host "##vso[task.setvariable variable=PackageVersion]$(Build.BuildNumber)$(BuildVersionPostfix)"
}
elseif ("$(Build.SourceBranchName)" -eq $branch2)
{
echo "the build is on $branch2"
Write-Host "##vso[task.setvariable variable=PackageVersion]$(Build.BuildNumber)"
}
else
{
echo "it's either on $branch1 branch nor $branch2 branch"
}
displayName: 'Set PackageVersion'
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: ''
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Run UnitTests'
inputs:
command: test
projects: '**/*.Tests.csproj '
arguments: ''
- task: DotNetCoreCLI@2
displayName: 'dotnet pack'
inputs:
command: pack
packagesToPack: EntityFramework.Toolkit.EF6/EntityFramework.Toolkit.EF6.csproj
versioningScheme: byEnvVar
versionEnvVar: PackageVersion
- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
SearchPattern: '**\bin\**\*.pdb'
PublishSymbols: false
continueOnError: true
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(system.defaultworkingdirectory)'
Contents: |
**\bin\$(BuildConfiguration)\**
**\bin\*.nupkg
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'