-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
96 lines (80 loc) · 3.33 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
trigger:
- master
- rel/*
pr:
- master
- rel/*
variables:
majorVer: '2'
minorVer: '0'
revisionVer: '0'
dottedVersion: '$(majorVer).$(minorVer).$(revisionVer).0'
buildPlatform: 'x86'
buildConfiguration: 'Release'
msixProjectPath: "./src/WvdMigration/MsixPackage"
packageManifestName: "$(msixProjectPath)/Package.appxmanifest"
publishedPackageName: "WvdMigration.$(dottedVersion).msix"
publishedVhdName: "WvdMigration.$(dottedVersion).vhd"
intermediatePackagePath: ".\\msixmgr\\x64\\$(publishedPackageName)"
pfxName: "MsixPackage_TemporaryKey.pfx"
vhdSize: "6"
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
jobs:
- job: Build
pool:
vmImage: windows-2019
steps:
- powershell: |
# Update AppxManifest. This must be done before the build.
[xml]$manifest = get-content "$(packageManifestName)"
$manifest.Package.Identity.Version = "$(dottedVersion)"
$manifest.save("$(packageManifestName)")
displayName: 'Update manifest version'
- task: MSBuild@1
inputs:
solution: '**/*.sln'
platform: $(buildPlatform)
configuration: $(buildConfiguration)
msbuildArguments: '/restore /p:UapAppxPackageBuildMode=$(MsixBuildMode) /p:AppxPackageOutput=$(Build.artifactStagingDirectory)/$(publishedPackageName)'
maximumCpuCount: false
displayName: 'Build solution'
- task: DownloadSecureFile@1
inputs:
secureFile: "$(pfxName)"
displayName: 'Download PFX from secure storage'
- script: '"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\signtool" sign /fd SHA256 /f $(Agent.TempDirectory)/$(pfxName) $(Build.artifactStagingDirectory)/$(publishedPackageName)'
condition: succeeded()
displayName: 'Sign MSIX Package'
- script: copy $(Build.artifactStagingDirectory)\$(publishedPackageName) $(intermediatePackagePath)
condition: succeeded()
displayName: 'Setup MsixMgr files'
- task: CmdLine@2
inputs:
script: |
echo.> c:\temp\command.txt create vdisk file=c:\temp\$(publishedVhdName) maximum=$(vhdSize)
diskpart /s c:\temp\command.txt
displayName: 'Create VHD'
# Mount VHD, Create root directory & Expand MSIX into VHD
- powershell: |
$vhdObject = Mount-DiskImage c:\temp\$(publishedVhdName) -Passthru
$disk = Initialize-Disk -Passthru -Number $vhdObject.Number -PartitionStyle MBR
$partition = New-Partition -AssignDriveLetter -UseMaximumSize -DiskNumber $disk.Number
Format-Volume -FileSystem NTFS -Confirm:$false -DriveLetter $partition.DriveLetter -Force
$vhdRoot = $partition.DriveLetter + ':\VHDRoot'
New-Item -Path $vhdRoot -ItemType Directory
.\msixmgr\x64\msixmgr.exe -Unpack -packagePath $(intermediatePackagePath) -destination $vhdRoot -applyacls
Dismount-DiskImage c:\temp\$(publishedVhdName)
displayName: Expanded MSIX into VHD
- script: copy c:\temp\$(publishedVhdName) $(build.artifactStagingDirectory)
condition: succeeded()
displayName: 'Copy VHD to Output dir'
- task: CopyFiles@2
inputs:
SourceFolder: '$(system.defaultWorkingDirectory)'
Contents: '**\bin\$(buildConfiguration)\**'
TargetFolder: '$(build.artifactStagingDirectory)'
displayName: 'Copy Files to: $(build.artifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(build.artifactStagingDirectory)'
displayName: 'Publish Artifact: drop'