-
Notifications
You must be signed in to change notification settings - Fork 39
/
azure-pipelines.yml
107 lines (91 loc) · 3.98 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
99
100
101
102
103
104
105
106
107
variables:
solution: 'linq2db.EFCore.sln'
build_configuration: 'Release'
assemblyVersion: 9.0.0
nugetVersion: 9.0.0
artifact_nugets: 'nugets'
# build on commits to important branches (master + release branches):
trigger:
- master
- release
# don't trigger pr builds by default, users should trigger them manually using /azp bot commands
# when we have multiple test runs waiting for free job, when nobody needs them
# we only want to trigger it for pr to release branch
pr:
- master
stages:
#############################
# Build and publish nugets #
#############################
- stage: ''
displayName: ''
jobs:
- job: build_job
pool:
vmImage: 'windows-2022'
variables:
packageVersion: $(nugetVersion)
displayName: 'Build'
steps:
- task: UseDotNet@2
displayName: 'Install .NET 9'
inputs:
includePreviewVersions: true
version: 9.x
- task: PowerShell@2
inputs:
filePath: '$(Build.SourcesDirectory)/Build/SetVersion.ps1'
workingDirectory: '$(Build.SourcesDirectory)'
arguments: -path $(Build.SourcesDirectory)/Directory.Build.props -version $(assemblyVersion)
displayName: Update assembly version
- task: DotNetCoreCLI@2
inputs:
command: 'build'
projects: '$(solution)'
arguments: '-property:ContinuousIntegrationBuild=true --configuration $(build_configuration)'
displayName: Build Solution
- powershell: echo "##vso[task.setvariable variable=packageVersion]$(packageVersion)-rc.$(Build.BuildId)"
displayName: Set nuget RC version for non-release branch
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
- task: PowerShell@2
inputs:
filePath: '$(Build.SourcesDirectory)/NuGet/BuildNuspecs.ps1'
workingDirectory: '$(Build.SourcesDirectory)'
arguments: -path $(Build.SourcesDirectory)/NuGet/linq2db.EntityFrameworkCore.nuspec -version $(packageVersion) -branch $(Build.SourceBranchName)
displayName: Generate nuspec
condition: and(succeeded(), or(eq(variables['Build.SourceBranchName'], 'release'), eq(variables['Build.SourceBranchName'], 'master')))
- task: NuGetToolInstaller@1
- task: CmdLine@2
inputs:
script: 'nuget Pack linq2db.EntityFrameworkCore.nuspec -OutputDirectory built'
workingDirectory: $(Build.SourcesDirectory)/NuGet
displayName: Build nuget (azure artifacts)
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
- task: CmdLine@2
inputs:
script: 'nuget Pack linq2db.EntityFrameworkCore.nuspec -OutputDirectory built -Symbols -SymbolPackageFormat snupkg'
workingDirectory: $(Build.SourcesDirectory)/NuGet
displayName: Build nuget (nuget.org)
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'release'))
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.SourcesDirectory)/NuGet/built'
artifactName: '$(artifact_nugets)'
displayName: Publish nugets to artifacts
condition: and(succeeded(), or(eq(variables['Build.SourceBranchName'], 'release'), eq(variables['Build.SourceBranchName'], 'master')))
- task: NuGetCommand@2
inputs:
command: 'push'
packagesToPush: '$(Build.SourcesDirectory)/NuGet/built/linq2db.EntityFrameworkCore.*.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: '0dcc414b-ea54-451e-a54f-d63f05367c4b/967a4107-9788-41a4-9f6d-a2318aab1410'
displayName: Publish to Azure Artifacts feed
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master'))
- task: NuGetCommand@2
inputs:
command: 'push'
packagesToPush: '$(Build.SourcesDirectory)/NuGet/built/linq2db.EntityFrameworkCore.*.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'linq2db nuget.org feed'
displayName: Publish to Nuget.org
condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'release'))