-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathazure-pipelines.release.yml
More file actions
225 lines (192 loc) · 9.01 KB
/
azure-pipelines.release.yml
File metadata and controls
225 lines (192 loc) · 9.01 KB
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
trigger: none
variables:
# Solution name
solution: "src/WingetCreateCLI.sln"
# Appx Package Directory
appxPackageDir: '$(System.DefaultWorkingDirectory)\AppxPackages'
# Agent VM image name
vmImageName: "windows-latest"
# Working Directory
workingDirectory: '$(System.DefaultWorkingDirectory)\src'
# Build configuration
buildConfiguration: "Release"
# Build platform
buildPlatform: "x64"
# Docker image which is used to build the project
WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2022/vse2022:latest'
resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main
extends:
template: v2/Microsoft.Official.yml@templates
parameters:
featureFlags:
WindowsHostVersion:
Version: 2022
Network: R1
platform:
name: 'windows_undocked'
git:
fetchTags: false
stages:
- stage: deploy
jobs:
- job: GetVersion
pool:
type: windows
variables:
runCodesignValidationInjection: ${{ false }}
skipComponentGovernanceDetection: ${{ true }}
ob_outputDirectory: $(Build.ArtifactStagingDirectory)/wingetcreate
steps:
- task: PowerShell@2
name: GetVersionStep
displayName: Get version from CLI project
inputs:
targetType: inline
script: |
[xml]$project = get-content "$(workingDirectory)/WingetCreateCLI/WingetCreateCLI.csproj"
$version = @($project.Project.PropertyGroup)[0].Version
echo "##vso[task.setvariable variable=majorMinorVersion;isOutput=true]$version"
- job: Build
displayName: Build
dependsOn: GetVersion
pool:
type: windows
variables:
majorMinorVersion: $[dependencies.GetVersion.outputs['GetVersionStep.majorMinorVersion']]
buildVersion: $[counter(variables['majorMinorVersion'], 1)]
version: "$(majorMinorVersion).$(buildVersion).0"
appxBundleFile: "Microsoft.WindowsPackageManagerManifestCreator_$(version)_8wekyb3d8bbwe.msixbundle"
appxBundlePath: '$(appxPackageDir)\$(appxBundleFile)'
exeDirFrameworkDependent: '$(appxPackageDir)\dependent'
exePathFrameworkDependent: '$(exeDirFrameworkDependent)\WingetCreateCLI\wingetcreate.exe'
ob_outputDirectory: $(Build.ArtifactStagingDirectory)
ob_symbolsPublishing_enabled: true
steps:
- task: PowerShell@2
name: InspectSDKs
displayName: 'Inspect installed UAP SDKs'
inputs:
targetType: inline
script: |
Write-Host "Installed Windows Kits:"
Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\Platforms\UAP' -ErrorAction SilentlyContinue | Select Name
Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP' -ErrorAction SilentlyContinue | Select Name
- task: PowerShell@2
name: OutputVersionStep
displayName: Set output variables for UpdateManifest job
inputs:
targetType: inline
script: |
echo $(version)
echo $(appxBundlePath)
echo $(appxBundleFile)
echo $(exePathFrameworkDependent)
echo "##vso[task.setvariable variable=manifestVersion;isOutput=true]$(version)"
echo "##vso[task.setvariable variable=appxBundleFile;isOutput=true]$(appxBundleFile)"
- task: PowerShell@2
displayName: "Update cli and package manifest version"
inputs:
targetType: inline
script: |
[xml]$manifest = get-content "$(workingDirectory)/WingetCreatePackage/Package.appxmanifest"
$manifest.Package.Identity.Version = "$(version)"
$manifest.save("$(workingDirectory)/WingetCreatePackage/Package.appxmanifest")
[xml]$project = get-content "$(workingDirectory)/WingetCreateCLI/WingetCreateCLI.csproj"
@($project.Project.PropertyGroup)[0].Version = "$(version)"
$project.save("$(workingDirectory)/WingetCreateCLI/WingetCreateCLI.csproj")
- task: DeleteFiles@1
displayName: "Delete existing stubbed TelemetryEventSources.cs. Not necessary, but will cause build to fail if fetch fails."
inputs:
Contents: '$(workingDirectory)\WingetCreateCLI\Telemetry\TelemetryEventSource.cs'
- task: PkgESGitFetch@10
displayName: "Fetch TelemetryEventSource.cs from OS repo and overwrite stubbed version"
inputs:
repository: "https://microsoft.visualstudio.com/os/_git/os.2020"
branch: official/main
source: 'minkernel\published\internal\telemetry\TelemetryEventSource.cs'
destination: '$(workingDirectory)\WingetCreateCLI\Telemetry\'
# Copies binary dependencies from VCLibs package to be included in standalone exe
- task: PowerShell@2
displayName: Download VCLibs package
inputs:
targetType: 'inline'
script: |
iwr https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx
- task: ExtractFiles@1
displayName: Extract files from VCLibs appx
inputs:
archiveFilePatterns: 'Microsoft.VCLibs.x64.14.00.Desktop.appx'
destinationFolder: '$(workingDirectory)\WingetCreateCLI'
cleanDestinationFolder: false
overwriteExistingFiles: false
- powershell: Move-Item NuGet.Internal.config NuGet.config -Force
displayName: Configure internal feed
workingDirectory: $(Build.SourcesDirectory)
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
feedsToUse: config
nugetConfigPath: "nuget.config"
projects: $(workingDirectory)/**/*.csproj
- task: DotNetCoreCLI@2
displayName: Build standalone, framework-dependent exe
inputs:
command: publish
publishWebProjects: false
zipAfterPublish: false
projects: $(workingDirectory)/**/WingetCreateCLI.csproj
arguments: "--configuration Release --runtime=win-x64 --output $(exeDirFrameworkDependent) -p:DebugType=None -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true --self-contained=false"
- task: MSBuild@1
displayName: Build Solution
inputs:
platform: "$(buildPlatform)"
solution: "$(solution)"
configuration: "$(buildConfiguration)"
msbuildArguments: '/p:AppxBundleOutput="$(appxBundlePath)"
/p:AppxBundle=Always
/p:UapAppxPackageBuildMode=SideloadOnly
/p:AppxPackageSigningEnabled=false'
- task: onebranch.pipeline.signing@1
displayName: 'CodeSigning'
inputs:
command: 'sign'
cp_code: 400 # CP-230012 - Microsoft Corporation (SHA2 Root - Standard Root)
search_root: $(appxPackageDir)
files_to_sign: |
$(appxBundlePath);
**\WingetCreateCLI.exe
- task: PowerShell@2
displayName: "Create hash files"
inputs:
targetType: inline
script: |
ren "$(exeDirFrameworkDependent)\WingetCreateCLI\WingetCreateCLI.exe" wingetcreate.exe
(Get-FileHash -Algorithm SHA256 -Path $(exePathFrameworkDependent)).Hash > "$(exePathFrameworkDependent).txt"
(Get-FileHash -Algorithm SHA256 -Path $(appxBundlePath)).Hash > "$(appxBundlePath).txt"
- task: CopyFiles@2
displayName: Copy files to be published to staging directory
inputs:
targetFolder: $(ob_outputDirectory)
flattenFolders: true
contents: |
$(exePathFrameworkDependent)
$(exePathFrameworkDependent).txt
$(appxBundlePath)
$(appxBundlePath).txt
- job: Wait
displayName: Wait for vanity URL to be manually updated
dependsOn: Build
pool:
type: agentless
timeoutInMinutes: 1440 # job times out in 1 day
steps:
- task: ManualValidation@0
timeoutInMinutes: 1440 # task times out in 1 day
inputs:
instructions: "Please update aka.ms vanity URLs for latest release"