-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
188 lines (179 loc) · 5.63 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
variables:
buildConfiguration: 'Release'
jobs:
- job: Windows
displayName: 'Build on Windows'
pool:
vmImage: 'Windows-latest'
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '3.1.x'
- powershell: |
function Edit-XmlNodes {
param (
[string] $file = $(throw "file is a required parameter"),
[string] $xpath = $(throw "xpath is a required parameter"),
[string] $value = $(throw "value is a required parameter")
)
[System.IO.Directory]::SetCurrentDirectory((Get-Location))
$doc = [xml](Get-Content $file)
"edit $file $xpath $value"
$namespace = $doc.DocumentElement.NamespaceURI
"namespace = $namespace"
$ns = New-Object System.Xml.XmlNamespaceManager($doc.NameTable)
$ns.AddNamespace("ns", $namespace)
$nodes = $doc.SelectNodes($xpath, $ns)
foreach ($node in $nodes) {
"node found " + $node
if ($node -ne $null) {
if ($node.NodeType -eq "Element") {
"node inner replaced to " + $value
$node.InnerXml = $value
}
else {
"node value replaced to " + $value
$node.Value = $value
}
}
}
$doc.save($file)
"done..."
}
$ver=$env:BUILD_SOURCEBRANCHNAME
$ver = $ver.TrimStart('v')
"ver="
$v = [Version]"0.0.0"
if ([System.Version]::TryParse($ver, [ref] $v)) {
Edit-XmlNodes "grepl\grepl.csproj" "//ns:Version" $ver
}
displayName: 'Update Version'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Pack as tool
inputs:
command: pack
packagesToPack: grepl/grepl.csproj
configuration: '$(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Publish win-x64
inputs:
command: publish
publishWebProjects: false
projects: 'grepl\grepl.csproj'
arguments: '-c $(BuildConfiguration) -r win-x64 -p:PublishSingleFile=true --self-contained false'
zipAfterPublish: false
modifyOutputPath: false
- task: CopyFiles@2
inputs:
Contents: 'Grepl\bin\Release\netcoreapp3.1\win-x64\publish\**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/win-x64'
flattenFolders: true
- task: DotNetCoreCLI@2
displayName: Publish linux-x64
inputs:
command: publish
publishWebProjects: false
projects: 'grepl/grepl.csproj'
arguments: '-c $(BuildConfiguration) -r linux-x64 -p:PublishSingleFile=true --self-contained false'
zipAfterPublish: false
modifyOutputPath: false
- task: CopyFiles@2
inputs:
Contents: 'Grepl\bin\Release\netcoreapp3.1\linux-x64\publish\**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/linux-x64'
flattenFolders: true
- task: DotNetCoreCLI@2
displayName: Publish linux-arm
inputs:
command: publish
publishWebProjects: false
projects: 'grepl/grepl.csproj'
arguments: '-c $(BuildConfiguration) -r linux-arm -p:PublishSingleFile=true --self-contained false'
zipAfterPublish: false
modifyOutputPath: false
- task: CopyFiles@2
inputs:
Contents: 'Grepl\bin\Release\netcoreapp3.1\linux-arm\publish\**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/linux-arm'
flattenFolders: true
- task: DotNetCoreCLI@2
displayName: Publish linux-arm64
inputs:
command: publish
publishWebProjects: false
projects: 'grepl/grepl.csproj'
arguments: '-c $(BuildConfiguration) -r linux-arm64 -p:PublishSingleFile=true --self-contained false'
zipAfterPublish: false
modifyOutputPath: false
- task: CopyFiles@2
inputs:
Contents: 'Grepl\bin\Release\netcoreapp3.1\linux-arm64\publish\**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/linux-arm64'
flattenFolders: true
- task: DotNetCoreCLI@2
displayName: Publish osx-x64
inputs:
command: publish
publishWebProjects: false
projects: 'grepl\grepl.csproj'
arguments: '-c $(BuildConfiguration) -r osx-x64 -p:PublishSingleFile=true --self-contained false'
zipAfterPublish: false
modifyOutputPath: false
- task: CopyFiles@2
inputs:
Contents: 'Grepl/bin/Release/netcoreapp3.1/osx-x64/publish/**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/osx-x64'
flattenFolders: true
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
- job: Linux
displayName: 'Build on Linux'
pool:
vmImage: 'ubuntu-latest'
steps:
# - task: UseDotNet@2
# inputs:
# packageType: 'sdk'
# version: '3.1.x'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
arguments: '--configuration $(BuildConfiguration)'
- job: macOS
displayName: 'Build on macOS'
pool:
vmImage: 'macOS-latest'
steps:
# - task: UseDotNet@2
# inputs:
# packageType: 'sdk'
# version: '3.1.x'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
arguments: '--configuration $(BuildConfiguration)'