-
Notifications
You must be signed in to change notification settings - Fork 16
/
azure-pipelines.yml
135 lines (128 loc) · 4.82 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
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
variables:
versionprefix: 0.1.0
jobs:
- job: 'BuildPackage'
strategy:
matrix:
linux:
imageName: 'ubuntu-18.04'
rid: 'linux-x64'
mac:
imageName: 'macos-10.14'
rid: 'osx-x64'
windows:
rid: 'windows-x64'
imageName: 'windows-2019'
pool:
vmImage: $(imageName)
variables:
buildConfiguration: 'Release'
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 3.0.100
installationPath: $(Agent.ToolsDirectory)/dotnet
- task: CmdLine@2
displayName: 'Install linux dependencies'
condition: eq(variables.rid, 'linux-x64')
inputs:
script: 'sudo apt-get update && sudo apt-get install libgtk-3-dev libwebkit2gtk-4.0-dev'
- task: NuGetCommand@2
displayName: 'NuGet package restore for Windows native packages'
condition: eq(variables.rid, 'windows-x64')
inputs:
command: 'restore'
restoreSolution: 'WebWindow.Native.sln'
feedsToUse: 'select'
- task: VSBuild@1
displayName: 'Build Windows native assets'
condition: eq(variables.rid, 'windows-x64')
inputs:
solution: 'WebWindow.Native.sln'
platform: 'x64'
configuration: '$(buildConfiguration)'
- task: CmdLine@2
displayName: 'Build Linux/macOS native assets'
condition: ne(variables.rid, 'windows-x64')
inputs:
script: 'dotnet build -c $(buildConfiguration) src/WebWindow/WebWindow.csproj /t:BuildNonWindowsNative'
- task: CmdLine@2
condition: eq(variables.rid, 'windows-x64')
displayName: 'Build .js artifact for WebWindow.Blazor.JS'
inputs:
script: 'dotnet build -c $(buildConfiguration) src/WebWindow.Blazor.JS'
- task: CmdLine@2
displayName: 'dotnet pack WebWindow'
inputs:
script: 'dotnet pack -c $(buildConfiguration) src/WebWindow/WebWindow.csproj /p:VersionPrefix=$(versionprefix) /p:VersionSuffix=$(Build.BuildNumber)'
- task: CmdLine@2
condition: eq(variables.rid, 'windows-x64')
displayName: 'dotnet pack WebWindow.Blazor'
inputs:
script: 'dotnet pack -c $(buildConfiguration) src/WebWindow.Blazor/WebWindow.Blazor.csproj /p:VersionPrefix=$(versionprefix) /p:VersionSuffix=$(Build.BuildNumber)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'artifacts'
ArtifactName: 'artifacts-$(rid)'
publishLocation: 'Container'
- job: 'CombinePackages'
dependsOn: 'BuildPackage'
steps:
- task: DownloadBuildArtifacts@0
inputs:
downloadPath: 'artifacts'
artifactName: 'artifacts-windows-x64'
- task: DownloadBuildArtifacts@0
inputs:
downloadPath: 'artifacts'
artifactName: 'artifacts-linux-x64'
- task: DownloadBuildArtifacts@0
inputs:
downloadPath: 'artifacts'
artifactName: 'artifacts-osx-x64'
- task: CmdLine@2
inputs:
script: 'ls -R artifacts'
- task: CmdLine@2
displayName: 'Merge .nupkg files'
inputs:
script: 'sudo apt install zipmerge && mkdir combined && zipmerge combined/WebWindow.$(versionprefix)-$(Build.BuildNumber).nupkg artifacts/*/WebWindow.$(versionprefix)-$(Build.BuildNumber).nupkg'
- task: CmdLine@2
displayName: 'Copy WebWindow.Blazor nupkg to output'
inputs:
script: 'cp artifacts/artifacts-windows-x64/WebWindow.Blazor.*.nupkg combined/'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'combined'
ArtifactName: 'artifacts-combined'
publishLocation: 'Container'
# Uploads the NuGet package file to nuget.org
# Important notes:
# 1. For this to work, you need to create a 'service connection' with the same name
# as the 'publishFeedCredentials' value.
# 2. For security, you *must* ensure that 'Make secrets available to builds of forks'
# is disabled in your PR validation settings (inside build -> Edit -> Triggers).
# Otherwise, PRs would be able to push new packages even without being merged.
- job: 'PublishToNuGet'
dependsOn: 'CombinePackages'
steps:
- task: DownloadBuildArtifacts@0
inputs:
downloadPath: 'artifacts'
artifactName: 'artifacts-combined'
- task: NuGetCommand@2
displayName: 'Publish to nuget.org'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
inputs:
command: push
packagesToPush: 'artifacts/artifacts-combined/*.nupkg'
nuGetFeedType: external
publishFeedCredentials: 'WebWindowNuGet'