-
Notifications
You must be signed in to change notification settings - Fork 8
/
azure-pipelines.yml
94 lines (81 loc) · 3.12 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
name: $(TeamProject)_$(Build.DefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
parameters:
- name: cache_npm
displayName: Cache NPM packages
type: boolean
default: true
- name: cache_nuget
displayName: Cache NuGet packages
type: boolean
default: false
variables:
nodeVersion: 16.17.x
solution: NestingContently.sln
buildConfiguration: Release
DOTNET_NOLOGO: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
stages:
- stage: Build
variables:
NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages
npm_config_cache: $(Pipeline.Workspace)/.npm_client
jobs:
- job: Build
pool:
vmImage: ubuntu-latest
steps:
# Checkout source (avoid shallow clone to calculate version height)
- checkout: self
fetchDepth: 0
# Setup build environment
- task: NuGetAuthenticate@1
displayName: Authenticate NuGet
- task: NodeTool@0
displayName: Use Node.js $(nodeVersion)
inputs:
versionSpec: $(nodeVersion)
- task: UseDotNet@2
displayName: Use .NET SDK from global.json
inputs:
useGlobalJson: true
# Cache and restore NPM packages
- task: Cache@2
condition: ${{ parameters.cache_npm }}
displayName: Cache NPM packages
inputs:
key: 'npm | "$(Agent.OS)" | **/package-lock.json, !**/node_modules/**'
restoreKeys: |
npm | "$(Agent.OS)"
npm
path: $(npm_config_cache)
# Cache and restore NuGet packages
- task: Cache@2
condition: ${{ parameters.cache_nuget }}
displayName: Cache NuGet packages
inputs:
key: 'nuget | "$(Agent.OS)" | **/packages.lock.json, !**/bin/**, !**/obj/**'
restoreKeys: |
nuget | "$(Agent.OS)"
nuget
path: $(NUGET_PACKAGES)
- script: dotnet restore $(solution) --locked-mode
displayName: Restore NuGet packages
# Build
- script: dotnet build $(solution) --configuration $(buildConfiguration) --no-restore -p:ContinuousIntegrationBuild=true
displayName: Run dotnet build
# Pack (using --no-build causes RCL projects to generate an invalid package, even using .NET SDK 7, so keep --no-restore for now)
- script: dotnet pack $(solution) --configuration $(buildConfiguration) --no-restore --output $(Build.ArtifactStagingDirectory)/nupkg
displayName: Run dotnet pack
# Publish
- task: PublishPipelineArtifact@1
displayName: Publish NuGet packages
inputs:
targetPath: $(Build.ArtifactStagingDirectory)/nupkg
artifactName: nupkg
- task: PublishPipelineArtifact@1
displayName: Publish build output
inputs:
targetPath: $(Build.SourcesDirectory)
artifactName: build_output