Skip to content

Commit 9d09d72

Browse files
authored
Fix release signing (#301)
1 parent 733341b commit 9d09d72

File tree

3 files changed

+109
-12
lines changed

3 files changed

+109
-12
lines changed

pipelines/publish-powershell-module.yml

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ variables:
1212
moduleName: Microsoft.WinGet.RestSource
1313
sourceArtifactName: WinGet.RestSource-WinGet.PowerShell.Source
1414
downloadRoot: $(Pipeline.Workspace)\buildRelease\$(sourceArtifactName)
15+
azureFunctionArtifactName: WinGet.RestSource-WinGet.RestSource.Functions
16+
azureFunctionDownloadRoot: $(Pipeline.Workspace)\buildRelease\$(azureFunctionArtifactName)
17+
azureFunctionLegacyArtifactName: WinGet.RestSource-WinGet.RestSource.Functions.LegacySupport
18+
azureFunctionLegacyDownloadRoot: $(Pipeline.Workspace)\buildRelease\$(azureFunctionLegacyArtifactName)
1519

1620
# Docker image which is used to build the project
1721
WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2019/vse2022:latest'
@@ -49,7 +53,7 @@ extends:
4953
pool:
5054
type: windows
5155
variables:
52-
ob_outputDirectory: $(Build.ArtifactStagingDirectory)/$(moduleName)
56+
ob_outputDirectory: $(Build.ArtifactStagingDirectory)
5357

5458
steps:
5559
- task: NuGetToolInstaller@1
@@ -90,11 +94,11 @@ extends:
9094
signing_profile: 'external_distribution'
9195
search_root: '$(downloadRoot)'
9296
files_to_sign: |
93-
Microsoft.WinGet.RestSource.psd1
94-
Microsoft.WinGet.RestSource.psm1
95-
Library/*.ps1
96-
Library/WinGet.RestSource.PowershellSupport/Microsoft.WinGet.PowershellSupport.dll
97-
Library/WinGet.RestSource.PowershellSupport/Microsoft.WinGet.RestSource.Utils.dll
97+
Microsoft.WinGet.RestSource.psd1;
98+
Microsoft.WinGet.RestSource.psm1;
99+
Library/*.ps1;
100+
Library/WinGet.RestSource.PowershellSupport/Microsoft.WinGet.PowershellSupport.dll;
101+
Library/WinGet.RestSource.PowershellSupport/Microsoft.WinGet.RestSource.Utils.dll;
98102
99103
- task: onebranch.pipeline.signing@1
100104
displayName: 'Sign 3rd party module files'
@@ -103,7 +107,11 @@ extends:
103107
cp_code: '135020002' # CP-231522 - Microsoft 3rd Party Application Component (SHA2)
104108
search_root: '$(downloadRoot)'
105109
files_to_sign: |
106-
Library/WinGet.RestSource.PowershellSupport/YamlDotNet.dll
110+
Library/WinGet.RestSource.PowershellSupport/YamlDotNet.dll;
111+
112+
- template: pipelines/templates/sign-azure-function.yml@self
113+
parameters:
114+
azureFunctionFolder: '$(downloadRoot)\Data'
107115

108116
- task: CopyFiles@2
109117
displayName: Copy files to be published to staging directory
@@ -116,6 +124,40 @@ extends:
116124
Library/**
117125
Data/**
118126
127+
- download: buildRelease
128+
displayName: Download Azure Functions to sign
129+
artifact: $(azureFunctionArtifactName)
130+
patterns: '**'
131+
132+
- template: pipelines/templates/sign-azure-function.yml@self
133+
parameters:
134+
azureFunctionFolder: '$(azureFunctionDownloadRoot)'
135+
136+
- task: CopyFiles@2
137+
displayName: Copy Azure Functions to be published to staging directory
138+
inputs:
139+
SourceFolder: $(azureFunctionDownloadRoot)
140+
TargetFolder: $(Build.ArtifactStagingDirectory)/$(azureFunctionArtifactName)
141+
Contents: |
142+
**/*
143+
144+
- download: buildRelease
145+
displayName: Download Azure Functions Legacy to sign
146+
artifact: $(azureFunctionLegacyArtifactName)
147+
patterns: '**'
148+
149+
- template: pipelines/templates/sign-azure-function.yml@self
150+
parameters:
151+
azureFunctionFolder: '$(azureFunctionLegacyDownloadRoot)'
152+
153+
- task: CopyFiles@2
154+
displayName: Copy Azure Functions to be published to staging directory
155+
inputs:
156+
SourceFolder: $(azureFunctionLegacyDownloadRoot)
157+
TargetFolder: $(Build.ArtifactStagingDirectory)/$(azureFunctionLegacyArtifactName)
158+
Contents: |
159+
**/*
160+
119161
- stage: Publish
120162
displayName: Publish to PS Gallery
121163
dependsOn: Prepare
@@ -132,12 +174,9 @@ extends:
132174
inputs:
133175
- input: pipelineArtifact
134176
artifactName: drop_Prepare_Prepare_Sign
135-
targetPath: $(System.DefaultWorkingDirectory)/ModuleToPublish/$(moduleName)
177+
targetPath: $(System.DefaultWorkingDirectory)/ModuleToPublish/
136178
itemPattern: |
137-
*.psm1
138-
*.psd1
139-
Library/**
140-
Data/**
179+
Microsoft.WinGet.RestSource/**
141180
142181
steps:
143182
- pwsh: |
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Template helper to sign Azure Function zip package
2+
parameters:
3+
azureFunctionFolder: ''
4+
azureFunctionFileName: 'WinGet.RestSource.Functions.zip'
5+
6+
steps:
7+
- task: ExtractFiles@1
8+
displayName: 'Extract Files: ${{ parameters.azureFunctionFileName }}'
9+
inputs:
10+
archiveFilePatterns: '${{ parameters.azureFunctionFolder }}\${{ parameters.azureFunctionFileName }}'
11+
destinationFolder: '${{ parameters.azureFunctionFolder }}\ExtractedFiles'
12+
13+
- task: onebranch.pipeline.signing@1
14+
displayName: 'Sign 1st party module files'
15+
inputs:
16+
command: 'sign'
17+
signing_profile: 'external_distribution'
18+
search_root: '${{ parameters.azureFunctionFolder }}\ExtractedFiles'
19+
files_to_sign: |
20+
**/Microsoft.WindowsPackageManager.*.dll;
21+
**/Microsoft.WinGet.*.dll;
22+
23+
- task: onebranch.pipeline.signing@1
24+
displayName: 'Sign 3rd party module files'
25+
inputs:
26+
command: 'sign'
27+
cp_code: '135020002' # CP-231522 - Microsoft 3rd Party Application Component (SHA2)
28+
search_root: '${{ parameters.azureFunctionFolder }}\ExtractedFiles'
29+
files_to_sign: |
30+
**/Castle.*.dll;
31+
**/DnsClient.dll;
32+
**/Google.*.dll;
33+
**/[Gg]rpc*.dll;
34+
**/LinqKit.dll;
35+
**/NCrontab.*.dll;
36+
**/Newtonsoft.*.dll;
37+
**/OpenTelemetry*.dll;
38+
**/*[Ss][Qq][Ll][Ii][Tt][Ee]*.dll;
39+
**/System.Reactive*.dll;
40+
**/YamlDotNet.dll;
41+
42+
- task: ArchiveFiles@2
43+
displayName: 'Archive Files: ${{ parameters.azureFunctionFileName }}'
44+
inputs:
45+
rootFolderOrFile: '${{ parameters.azureFunctionFolder }}\ExtractedFiles'
46+
includeRootFolder: false
47+
archiveFile: '${{ parameters.azureFunctionFolder }}\${{ parameters.azureFunctionFileName }}'
48+
archiveType: 'zip'
49+
replaceExistingArchive: true
50+
51+
- task: DeleteFiles@1
52+
displayName: 'Clean Files: ${{ parameters.azureFunctionFileName }}'
53+
inputs:
54+
sourceFolder: '${{ parameters.azureFunctionFolder }}\ExtractedFiles'
55+
contents: |
56+
**/*
57+
removeSourceFolder: true

src/WinGet.RestSource.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Templates", "Templates", "{
3333
..\pipelines\templates\restore-build-publish-test.yml = ..\pipelines\templates\restore-build-publish-test.yml
3434
..\pipelines\templates\run-integrationtests.yml = ..\pipelines\templates\run-integrationtests.yml
3535
..\pipelines\templates\run-unittests.yml = ..\pipelines\templates\run-unittests.yml
36+
..\pipelines\templates\sign-azure-function.yml = ..\pipelines\templates\sign-azure-function.yml
3637
EndProjectSection
3738
EndProject
3839
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{E49C6A16-7E44-4318-8F1B-8B17EBFD5189}"

0 commit comments

Comments
 (0)