-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
98 lines (95 loc) · 3.08 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
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
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
- feature/*
- fix/*
variables:
buildConfiguration: 'Release'
PrePackageSuffix: 'pre'
NugetArtifactName: 'NugetPackages'
TargetFeed: '62400287-0f71-43a5-b125-2ad387e75023'
stages:
- stage: Build
jobs:
- job: Build
pool:
vmImage: 'ubuntu-latest'
steps:
- task: DotNetCoreCLI@2
inputs:
command: 'restore'
feedsToUse: 'select'
vstsFeed: '$(TargetFeed)'
- script: dotnet build --configuration $(buildConfiguration) --no-restore
displayName: 'dotnet build $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Run tests'
inputs:
command: 'test'
projects: 'test/**/*.csproj'
feedsToUse: 'select'
versioningScheme: 'off'
- task: DotNetCoreCLI@2
condition: succeeded()
displayName: 'Pack pre-package'
inputs:
command: custom
projects: '**/*.csproj'
custom: 'pack'
arguments: '--configuration $(buildConfiguration) --output $(build.artifactStagingDirectory)/pre --version-suffix "$(PrePackageSuffix)-$(Build.BuildNumber)" --no-restore --no-build'
- task: DotNetCoreCLI@2
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: 'Pack prod package'
inputs:
command: 'custom'
custom: 'pack'
packagesToPack: '**/*.csproj'
arguments: '--configuration $(buildConfiguration) --output $(build.artifactStagingDirectory)/prod'
- task: PublishPipelineArtifact@1
displayName: 'Publish artifacts'
inputs:
targetPath: '$(build.artifactStagingDirectory)'
artifact: '$(NugetPackages)'
- stage: Prerelease
condition: succeeded()
jobs:
# track deployments on the environment
- deployment: NugetPush
pool:
vmImage: 'ubuntu-latest'
# creates an environment if it doesn’t exist
environment: 'Prerelease'
strategy:
# default deployment strategy
runOnce:
deploy:
steps:
- task: DotNetCoreCLI@2
inputs:
command: 'push'
packagesToPush: '$(Pipeline.Workspace)/$(NugetPackages)/pre/*.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: '$(TargetFeed)'
- stage: Release
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
# track deployments on the environment
- deployment: NugetPush
pool:
vmImage: 'ubuntu-latest'
# creates an environment if it doesn’t exist
environment: 'Release'
strategy:
# default deployment strategy
runOnce:
deploy:
steps:
- task: DotNetCoreCLI@2
inputs:
command: 'push'
packagesToPush: '$(Pipeline.Workspace)/$(NugetPackages)/prod/*.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: '$(TargetFeed)'