forked from microsoft/winget-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.nuget.yml
144 lines (129 loc) · 5.07 KB
/
azure-pipelines.nuget.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
trigger: none
parameters:
- name: version
displayName: Version to stamp on binaries and nuget package. Should be in form of "major.minor", for example "1.0"
type: string
pool:
vmImage: "windows-latest"
variables:
solution: "src/AppInstallerCLI.sln"
buildConfiguration: "Release"
packageName: Microsoft.WindowsPackageManager.Utils
jobs:
- job: "Build"
timeoutInMinutes: 120
variables:
BuildVer: $[counter(${{ parameters.version }}, 1)]
version: ${{ parameters.version }}.$(BuildVer)
steps:
- script: echo $(version)
- task: NuGetToolInstaller@1
displayName: Install Nuget
# Restores all projects, including native (vcxproj) projects
- task: NuGetCommand@2
displayName: Restore Packages
inputs:
restoreSolution: "$(solution)"
# Restores only .NET core projects, but is still necessary, as without this the IndexCreationTool and LocalhostWebServer projects fail to build
- task: DotNetCoreCLI@2
displayName: DotNet Restore
inputs:
command: "restore"
projects: "**/*.csproj"
- task: PowerShell@2
displayName: Update Binary Version
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
inputs:
filePath: 'src\binver\Update-BinVer.ps1'
arguments: '-TargetFile binver\binver\version.h -BuildVersion $(BuildVer) -MajorMinorOverride ${{ parameters.version }}'
workingDirectory: "src"
- task: VSBuild@1
displayName: Build Solution x86
inputs:
platform: "x86"
solution: "$(solution)"
configuration: "$(buildConfiguration)"
- task: VSBuild@1
displayName: Build Solution x64
inputs:
platform: "x64"
solution: "$(solution)"
configuration: "$(buildConfiguration)"
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName: "ESRP CodeSigning - Package contents"
inputs:
ConnectedServiceName: "WindowsPackageManager ESRP CodeSigning"
FolderPath: src
Pattern: |
*\$(buildConfiguration)\WinGetUtil\WinGetUtil.dll
UseMinimatch: true
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode" : "CP-230012",
"OperationCode" : "SigntoolSign",
"Parameters" : {
"OpusName" : "Microsoft",
"OpusInfo" : "http://www.microsoft.com",
"FileDigest" : "/fd \"SHA256\"",
"PageHash" : "/NPH",
"TimeStamp" : "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-230012",
"OperationCode" : "SigntoolVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
- task: NuGetCommand@2
displayName: Pack WingetUtil nuget package
inputs:
command: pack
packagesToPack: WinGetUtil.nuspec
versioningScheme: byEnvVar
versionEnvVar: version
packDestination: "$(Build.ArtifactStagingDirectory)"
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName: "ESRP CodeSigning - NuGet package"
inputs:
ConnectedServiceName: "WindowsPackageManager ESRP CodeSigning"
FolderPath: "$(Build.ArtifactStagingDirectory)"
Pattern: "Microsoft.Packaging.WinGetUtil.$(version).nupkg"
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetSign",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
- task: PublishBuildArtifacts@1
displayName: Publish nuget package to artifacts
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\$(packageName).$(version).nupkg'
ArtifactName: $(packageName)
publishLocation: Container
- task: NuGetCommand@2
displayName: Push WingetUtil nuget package to nuget.org
inputs:
command: push
nuGetFeedType: external
includeNugetOrg: true
packagesToPush: '$(Build.ArtifactStagingDirectory)\$(packageName).$(version).nupkg'
publishFeedCredentials: "WindowsPackageManagerAzurePipelineNuget - NuGet.org"