• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1jobs:
2- job: Pack_MSIX
3  displayName: Pack MSIX bundles
4
5  pool:
6    vmImage: windows-2019
7
8  workspace:
9    clean: all
10
11  strategy:
12    matrix:
13      amd64:
14        Name: amd64
15        Artifact: appx
16        Suffix:
17        ShouldSign: true
18      amd64_store:
19        Name: amd64
20        Artifact: appxstore
21        Suffix: -store
22        Upload: true
23      arm64:
24        Name: arm64
25        Artifact: appx
26        Suffix:
27        ShouldSign: true
28      arm64_store:
29        Name: arm64
30        Artifact: appxstore
31        Suffix: -store
32        Upload: true
33
34  steps:
35  - template: ./checkout.yml
36
37  - task: DownloadPipelineArtifact@1
38    displayName: 'Download artifact: layout_$(Artifact)_$(Name)'
39    inputs:
40      artifactName: layout_$(Artifact)_$(Name)
41      targetPath: $(Build.BinariesDirectory)\layout
42
43  - task: DownloadBuildArtifacts@0
44    displayName: 'Download artifact: symbols'
45    inputs:
46      artifactName: symbols
47      downloadPath: $(Build.BinariesDirectory)
48
49  - powershell: |
50      $d = (.\PCbuild\build.bat -V) | %{ if($_ -match '\s+(\w+):\s*(.+)\s*$') { @{$Matches[1] = $Matches[2];} }};
51      Write-Host "##vso[task.setvariable variable=VersionText]$($d.PythonVersion)"
52      Write-Host "##vso[task.setvariable variable=VersionNumber]$($d.PythonVersionNumber)"
53      Write-Host "##vso[task.setvariable variable=VersionHex]$($d.PythonVersionHex)"
54      Write-Host "##vso[task.setvariable variable=VersionUnique]$($d.PythonVersionUnique)"
55      Write-Host "##vso[task.setvariable variable=Filename]python-$($d.PythonVersion)-$(Name)$(Suffix)"
56    displayName: 'Extract version numbers'
57
58  - powershell: |
59      ./Tools/msi/make_appx.ps1 -layout "$(Build.BinariesDirectory)\layout" -msix "$(Build.ArtifactStagingDirectory)\msix\$(Filename).msix"
60    displayName: 'Build msix'
61
62  - powershell: |
63      7z a -tzip "$(Build.ArtifactStagingDirectory)\msix\$(Filename).appxsym" *.pdb
64    displayName: 'Build appxsym'
65    workingDirectory: $(Build.BinariesDirectory)\symbols\$(Name)
66
67  - task: PublishBuildArtifacts@1
68    displayName: 'Publish Artifact: MSIX'
69    condition: and(succeeded(), or(ne(variables['ShouldSign'], 'true'), not(variables['SigningCertificate'])))
70    inputs:
71      PathtoPublish: '$(Build.ArtifactStagingDirectory)\msix'
72      ArtifactName: msix
73
74  - task: PublishBuildArtifacts@1
75    displayName: 'Publish Artifact: MSIX'
76    condition: and(succeeded(), and(eq(variables['ShouldSign'], 'true'), variables['SigningCertificate']))
77    inputs:
78      PathtoPublish: '$(Build.ArtifactStagingDirectory)\msix'
79      ArtifactName: unsigned_msix
80
81  - powershell: |
82      7z a -tzip "$(Build.ArtifactStagingDirectory)\msixupload\$(Filename).msixupload" *
83    displayName: 'Build msixupload'
84    condition: and(succeeded(), eq(variables['Upload'], 'true'))
85    workingDirectory: $(Build.ArtifactStagingDirectory)\msix
86
87  - task: PublishBuildArtifacts@1
88    displayName: 'Publish Artifact: MSIXUpload'
89    condition: and(succeeded(), eq(variables['Upload'], 'true'))
90    inputs:
91      PathtoPublish: '$(Build.ArtifactStagingDirectory)\msixupload'
92      ArtifactName: msixupload
93
94
95- job: Sign_MSIX
96  displayName: Sign side-loadable MSIX bundles
97  dependsOn:
98  - Pack_MSIX
99  condition: and(succeeded(), variables['SigningCertificate'])
100
101  pool:
102    name: 'Windows Release'
103
104  workspace:
105    clean: all
106
107  steps:
108  - checkout: none
109  - template: ./find-sdk.yml
110
111  - task: DownloadBuildArtifacts@0
112    displayName: 'Download Artifact: unsigned_msix'
113    inputs:
114      artifactName: unsigned_msix
115      downloadPath: $(Build.BinariesDirectory)
116
117  - powershell: |
118      $failed = $true
119      foreach ($retry in 1..3) {
120          signtool sign /a /n "$(SigningCertificate)" /fd sha256 /t http://timestamp.verisign.com/scripts/timestamp.dll /d "$(SigningDescription)" (gi *.msix)
121          if ($?) {
122              $failed = $false
123              break
124          }
125          sleep 1
126      }
127      if ($failed) {
128          throw "Failed to sign MSIX"
129      }
130    displayName: 'Sign MSIX'
131    workingDirectory: $(Build.BinariesDirectory)\unsigned_msix
132
133  - task: PublishBuildArtifacts@1
134    displayName: 'Publish Artifact: MSIX'
135    inputs:
136      PathtoPublish: '$(Build.BinariesDirectory)\unsigned_msix'
137      ArtifactName: msix
138