-
Notifications
You must be signed in to change notification settings - Fork 59
/
azure-pipelines.yml
203 lines (173 loc) · 7.04 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# .NET Desktop
# Build and run tests for .NET Desktop or Windows classic desktop solutions.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
trigger:
tags:
include:
- '1.*'
- '2.*'
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
artifactNetCoreName: 'WebDAVCloudMailRu-$(Build.SourceBranchName)-dotNetCore31.zip'
artifactNetFrameworkName: 'WebDAVCloudMailRu-$(Build.SourceBranchName)-dotNet48.zip'
artifactMonoName: 'WebDAVCloudMailRu-$(Build.SourceBranchName)-dotNet48.zip'
artifactNet5Name: 'WebDAVCloudMailRu-$(Build.SourceBranchName)-dotNet5.zip'
artifactNet6Name: 'WebDAVCloudMailRu-$(Build.SourceBranchName)-dotNet6.zip'
artifactNet7WinName: 'WebDAVCloudMailRu-$(Build.SourceBranchName)-dotNet7Win.zip'
steps:
- task: NuGetToolInstaller@1
inputs:
checkLatest: true
#=============================================================================================================
- task: VSBuild@1
displayName: .NET Build
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
vsVersion: 'latest'
msbuildArgs: '/t:"Restore;Build" /p:Configuration="Release" /p:Platform="Any CPU" /p:CopyOutputSymbolsToPublishDirectory=false'
- task: Bash@3
displayName: .NET artifacts clean
inputs:
targetType: 'inline'
script: 'rm WDMRC.Console/bin/Release/net48/*.pdb
&& rm -f WDMRC.Console/bin/Release/net48/Microsoft.*.dll
&& rm -f WDMRC.Console/bin/Release/net48/netstandard.dll'
- task: ArchiveFiles@2
displayName: .NET artifacts archive to WebDAVCloudMailRu-$(Build.SourceBranchName)-dotNet48.zip
inputs:
rootFolderOrFile: 'WDMRC.Console/bin/Release/net48/'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(artifactNetFrameworkName)'
replaceExistingArchive: true
#=============================================================================================================
- task: DotNetCoreCLI@2
displayName: .NET Core 3.1 publish
inputs:
command: 'publish'
projects: 'WDMRC.Console/WDMRC.Console.csproj'
publishWebProjects: false # Required when command == Publish
arguments: '--configuration $(BuildConfiguration) --framework netcoreapp3.1'
- task: Bash@3
displayName: .NETCore copy artifact to WebDAVCloudMailRu-$(Build.SourceBranchName)-dotNetCore31.zip
inputs:
targetType: 'inline'
script: 'cp WDMRC.Console/bin/Release/netcoreapp3.1/publish.zip ''$(Build.ArtifactStagingDirectory)''/$(artifactNetCoreName)'
#=============================================================================================================
- task: DotNetCoreCLI@2
displayName: .NET 5 publish
inputs:
command: 'publish'
projects: 'WDMRC.Console/WDMRC.Console.csproj'
publishWebProjects: false # Required when command == Publish
arguments: '--configuration $(BuildConfiguration) --framework net5.0'
- task: Bash@3
displayName: .NET 5 copy artifact to WebDAVCloudMailRu-$(Build.SourceBranchName)-dotNet5.zip
inputs:
targetType: 'inline'
script: 'cp WDMRC.Console/bin/Release/net5.0/publish.zip ''$(Build.ArtifactStagingDirectory)''/$(artifactNet5Name)'
#=============================================================================================================
- task: DotNetCoreCLI@2
displayName: .NET 6 publish
inputs:
command: 'publish'
projects: 'WDMRC.Console/WDMRC.Console.csproj'
publishWebProjects: false # Required when command == Publish
arguments: '--configuration $(BuildConfiguration) --framework net6.0'
- task: Bash@3
displayName: .NET 6 copy artifact to WebDAVCloudMailRu-$(Build.SourceBranchName)-dotNet6.zip
inputs:
targetType: 'inline'
script: 'cp WDMRC.Console/bin/Release/net6.0/publish.zip ''$(Build.ArtifactStagingDirectory)''/$(artifactNet6Name)'
#=============================================================================================================
- task: DotNetCoreCLI@2
displayName: .NET 7Win publish
inputs:
command: 'publish'
projects: 'WDMRC.Console/WDMRC.Console.csproj'
publishWebProjects: false # Required when command == Publish
arguments: '--configuration $(BuildConfiguration) --framework net7.0-windows'
- task: Bash@3
displayName: .NET 7Win copy artifact to WebDAVCloudMailRu-$(Build.SourceBranchName)-dotNet7Win.zip
inputs:
targetType: 'inline'
script: 'cp WDMRC.Console/bin/Release/net7.0-windows/publish.zip ''$(Build.ArtifactStagingDirectory)''/$(artifactNet7WinName)'
#=============================================================================================================
- task: PowerShell@2
displayName: Making release.info.json artifact
inputs:
targetType: 'inline'
script: |
New-Item $(Build.ArtifactStagingDirectory)\release.info.json
$content = @"
{
"version" : "$(Build.SourceBranchName)",
"info" :
{
"netcore" : {
"distrib" : "$(artifactNetCoreName)",
"runner" : "dotnet",
"file" : "wdmrc.dll",
"defaultkeys" : ""
},
"netframework" :
{
"distrib" : "$(artifactNetFrameworkName)",
"runner" : "",
"file" : "wdmrc.exe",
"defaultkeys" : ""
},
"mono" : {
"distrib" : "$(artifactMonoName)",
"runner" : "mono",
"file" : "wdmrc.exe",
"defaultkeys" : ""
},
"net5" : {
"distrib" : "$(artifactNet5Name)",
"runner" : "dotnet",
"file" : "wdmrc.dll",
"defaultkeys" : ""
},
"net6" : {
"distrib" : "$(artifactNet6Name)",
"runner" : "dotnet",
"file" : "wdmrc.dll",
"defaultkeys" : ""
},
"net7Win" : {
"distrib" : "$(artifactNet7WinName)",
"runner" : "dotnet",
"file" : "wdmrc.dll",
"defaultkeys" : ""
}
}
}
"@
Set-Content -Path $(Build.ArtifactStagingDirectory)\release.info.json -Value $content
#=============================================================================================================
- task: GitHubRelease@0
displayName: Publish artifacts to github
inputs:
gitHubConnection: YaRGithubAzure
repositoryName: '$(Build.Repository.Name)'
action: 'create' # Options: create, edit, delete
target: '$(Build.SourceVersion)' # Required when action == Create || Action == Edit
tagSource: 'auto' # Required when action == Create# Options: auto, manual
#=============================================================================================================
#- task: CmdLine@2
# inputs:
# script: 'tree $(Build.SourcesDirectory) /F'
- task: CmdLine@2
inputs:
script: 'tree $(Build.ArtifactStagingDirectory) /F'
- task: CmdLine@2
inputs:
script: 'type $(Build.ArtifactStagingDirectory)\release.info.json'