-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRelease.TeePee.yml
74 lines (63 loc) · 2.22 KB
/
Release.TeePee.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
name: 2.0$(rev:.r)
trigger: none
pr: none
pool:
vmImage: 'windows-latest'
variables:
solution: '**/TeePee.sln'
buildConfiguration: 'Release'
versionSuffix: '' #prefix with hyphen, e.g. -beta
autoPublishToNuGet: true
NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages
steps:
- task: UseDotNet@2
displayName: 'Use .NET 7'
inputs:
version: 7.x
- task: Cache@2
displayName: 'NuGet Pipeline Cache'
inputs:
key: 'nuget | "$(Agent.OS)" | TeePee/**/packages.lock.json,!**/bin/**,!**/obj/**'
restoreKeys: |
nuget | "$(Agent.OS)"
nuget
path: '$(NUGET_PACKAGES)'
- task: DotNetCoreCLI@2
displayName: 'Restore Solution'
inputs:
command: 'restore'
projects: '$(solution)'
arguments: '-c $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Build Solution'
inputs:
command: 'build'
projects: '$(solution)'
arguments: '-c $(buildConfiguration) --no-restore /p:Version=$(Build.BuildNumber)$(versionSuffix)'
- task: DotNetCoreCLI@2
displayName: 'Unit Tests'
inputs:
command: 'test'
projects: 'TeePee/**/*[Tt]ests.csproj'
arguments: '-c $(buildConfiguration) --no-build'
# Using direct dotnet command as I had Nupkg file name issues with DotNetCoreCLI pack task.
- task: PowerShell@2
displayName: Package NuGet
inputs:
targetType: 'inline'
script: |
dotnet pack TeePee/TeePee/TeePee.csproj -c $(buildConfiguration) --no-build -o $(Build.ArtifactStagingDirectory) /p:Version=$(Build.BuildNumber)$(versionSuffix)
- task: PublishBuildArtifacts@1
displayName: Publish NuGet Package
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'TeePee.Package'
publishLocation: 'Container'
# https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package-using-the-dotnet-cli#publish-with-dotnet-nuget-push
# https://github.com/NuGet/Home/issues/1234 - no option to push as unlisted
- task: PowerShell@2
displayName: 'Deploy to NuGet.org'
condition: and(succeeded(), eq(variables['autoPublishToNuGet'], 'true'))
inputs:
targetType: 'inline'
script: 'dotnet nuget push ''$(Build.ArtifactStagingDirectory)\*.nupkg'' --api-key $(nugetApiKey) --source ''https://api.nuget.org/v3/index.json'''