This repository has been archived by the owner on Dec 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
azure-pipelines.yml
65 lines (54 loc) · 1.86 KB
/
azure-pipelines.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
trigger:
branches:
include:
- master
- develop
- hotfix*
paths:
exclude:
- .editorconfig
- README.md
- stylecop.json
# Must be Windows due to the .NET 4.5 build target
pool:
vmImage: 'windows-latest'
variables:
buildConfiguration: 'Release'
buildPlatform: 'Any CPU'
buildVersion: '0.0.0'
projectPath: '.\MicroLite\MicroLite.csproj'
solution: '**/*.sln'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
codeCoverageEnabled: true
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
$projVersion = ([xml](Get-Content "$(projectPath)")) | Select-Xml -XPath "//Project/PropertyGroup[1]/Version"
Write-Host "##vso[task.setvariable variable=buildVersion]$projVersion"
- script: dotnet pack "$(projectPath)" -o:$(Build.ArtifactStagingDirectory) -p:PackageVersion="$(buildVersion)-preview$(Build.BuildNumber)"
displayName: 'dotnet pack (pre)'
condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/master'))
- script: dotnet pack "$(projectPath)" -o:$(Build.ArtifactStagingDirectory) -p:PackageVersion=$(buildVersion)
displayName: 'dotnet pack'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- task: NuGetCommand@2
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'NuGet.org (MicroLite-ORM)'
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual'))