-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
109 lines (98 loc) · 3.1 KB
/
azure-pipelines.yml
File metadata and controls
109 lines (98 loc) · 3.1 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
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
# Azure DevOps Pipeline for UCDArch.Consolidated
# This pipeline builds and deploys only the UCDArch.Consolidated .NET 6.0 project to NuGet
trigger:
branches:
include:
- master
paths:
include:
- UCDArch/UCDArch.Consolidated/**
exclude:
- UCDArch/UCDArch.Consolidated/bin/**
- UCDArch/UCDArch.Consolidated/obj/**
pr:
branches:
include:
- master
paths:
include:
- UCDArch/UCDArch.Consolidated/**
exclude:
- UCDArch/UCDArch.Consolidated/bin/**
- UCDArch/UCDArch.Consolidated/obj/**
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
projectPath: 'UCDArch/UCDArch.Consolidated/UCDArch.Consolidated.csproj'
majorVersion: 1
minorVersion: 1
patchVersion: $[counter(format('{0}.{1}', variables['majorVersion'], variables['minorVersion']), 0)]
version: $(majorVersion).$(minorVersion).$(patchVersion)
stages:
- stage: Build
displayName: 'Build Stage'
jobs:
- job: Build
displayName: 'Build UCDArch.Consolidated'
steps:
- task: UseDotNet@2
displayName: 'Use .NET 6.0 SDK'
inputs:
packageType: 'sdk'
version: '6.0.x'
includePreviewVersions: false
- task: DotNetCoreCLI@2
displayName: 'Restore NuGet packages'
inputs:
command: 'restore'
projects: '$(projectPath)'
feedsToUse: 'select'
- task: DotNetCoreCLI@2
displayName: 'Build project'
inputs:
command: 'build'
projects: '$(projectPath)'
arguments: '--configuration $(buildConfiguration) --no-restore'
- task: DotNetCoreCLI@2
displayName: 'Create NuGet package'
inputs:
command: 'pack'
packagesToPack: '$(projectPath)'
configuration: '$(buildConfiguration)'
packDirectory: '$(Build.ArtifactStagingDirectory)'
versioningScheme: 'off'
buildProperties: 'PackageVersion=$(version)'
- task: PublishBuildArtifacts@1
displayName: 'Publish build artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'nuget-packages'
publishLocation: 'Container'
- stage: Deploy
displayName: 'Deploy to NuGet'
dependsOn: Build
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- deployment: DeployToNuGet
displayName: 'Deploy to NuGet.org'
environment: 'nuget-production'
strategy:
runOnce:
deploy:
steps:
- task: DownloadBuildArtifacts@0
displayName: 'Download build artifacts'
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'nuget-packages'
downloadPath: '$(System.ArtifactsDirectory)'
- task: DotNetCoreCLI@2
displayName: 'Push to NuGet.org'
inputs:
command: 'custom'
custom: 'nuget'
arguments: 'push $(System.ArtifactsDirectory)/nuget-packages/*.nupkg --api-key $(NUGET_API_KEY) --source https://api.nuget.org/v3/index.json --skip-duplicate'
env:
NUGET_API_KEY: $(NUGET_API_KEY)