Skip to content

Commit e570ce5

Browse files
committed
Update to latest signing infrastructure
Fixes 7546
1 parent 409d3b6 commit e570ce5

File tree

5 files changed

+38
-48
lines changed

5 files changed

+38
-48
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424
build:
2525
name: Build
2626
runs-on: windows-2022
27+
permissions:
28+
packages: write
29+
id-token: write
2730
steps:
2831
- name: Checkout code
2932
uses: actions/checkout@v3
@@ -34,6 +37,11 @@ jobs:
3437
# shell: cmd
3538
# run: ./src/vs_config.cmd
3639

40+
- name: Install sign tool
41+
if: (github.ref == 'refs/heads/master')
42+
shell: cmd
43+
run: dotnet tool install --tool-path build\.tools sign --version 0.9.1-beta.23356.1
44+
3745
- name: Configure automated logging and crash dumps
3846
shell: cmd
3947
run: |
@@ -46,13 +54,22 @@ jobs:
4654
reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\Windows Error Reporting\LocalDumps" /t REG_DWORD /v DumpCount /d 10 /f
4755
reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\Windows Error Reporting\LocalDumps" /t REG_DWORD /v DumpType /d 1
4856
57+
- name: 'Az CLI login'
58+
if: (github.ref == 'refs/heads/master')
59+
uses: azure/login@v1
60+
with:
61+
allow-no-subscriptions: true
62+
client-id: ${{ secrets.WIX_SIGNING_CLIENTID }}
63+
tenant-id: ${{ secrets.WIX_SIGNING_TENANTID }}
64+
subscription-id: ${{ secrets.WIX_SIGNING_SUBSCRIPTIONID }}
65+
4966
- name: Build wix4
5067
shell: cmd
5168
run: ./src/build_official.cmd
5269
env:
5370
RuntimeTestsEnabled: true
54-
SigningUser: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_USER || '' }}
55-
SigningSecret: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_SECRET || '' }}
71+
SigningVaultUri: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_VAULTURI || '' }}
72+
SigningCertName: ${{ github.ref == 'refs/heads/master' && secrets.WIX_SIGNING_CERTNAME || '' }}
5673

5774
- name: Validate test results
5875
shell: cmd

src/Directory.Build.targets

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<Project>
55
<PropertyGroup>
66
<SigningToolFolder>$(ToolsFolder)</SigningToolFolder>
7-
<SigningToolExe>$(SigningToolFolder)\SignClient.exe</SigningToolExe>
8-
<SigningFilelist>$(SigningToolFolder)\empty-filelist.txt</SigningFilelist>
9-
<SigningConfiguration>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), signing.json))\signing.json</SigningConfiguration>
7+
<SigningToolExe>$(SigningToolFolder)\sign.exe</SigningToolExe>
8+
<SigningFilelist>$(MSBuildThisFileDirectory)signing-empty-file-list.txt</SigningFilelist>
9+
<SigningConfiguration>--description "WiX Toolset" --description-url "https://wixtoolset.org/" --timestamp-url "http://timestamp.digicert.com" --file-list "$(SigningFilelist)" --azure-key-vault-managed-identity true --azure-key-vault-url "$(SigningVaultUri)" --azure-key-vault-certificate "$(SigningCertName)"</SigningConfiguration>
1010
</PropertyGroup>
1111

1212
<PropertyGroup Condition=" '$(IsWixTestSupportProject)'=='true' ">
@@ -113,47 +113,39 @@
113113
</ItemGroup>
114114
</Target>
115115

116-
<Target Name="_GetSignClient"
117-
Condition=" !Exists('$(SigningToolExe)') ">
118-
119-
<WriteLinesToFile File='$(SigningFilelist)' Lines='do-not-sign-files-in-nupkg' Overwrite='true' />
120-
121-
<Exec Command='dotnet.exe tool install --tool-path "$(SigningToolFolder)" SignClient' IgnoreExitCode='true' />
122-
</Target>
123-
124-
<Target Name="SignOutput" DependsOnTargets="_GetSignClient" AfterTargets="AfterBuild"
125-
Condition=" '$(SigningUser)'!='' and '$(SignOutput)'!='false' and
116+
<Target Name="SignOutput" AfterTargets="AfterBuild"
117+
Condition=" '$(SigningCertName)'!='' and '$(SignOutput)'!='false' and
126118
('$(MSBuildProjectExtension)'=='.csproj' or ('$(MSBuildProjectExtension)'=='.vcxproj' and '$(ConfigurationType)'!='StaticLibrary'))">
127119

128-
<Message Importance="high" Text="Signing file: $(TargetPath) using configuration from: $(SigningConfiguration)" />
120+
<Message Importance="high" Text="Signing file: $(TargetPath)" />
129121

130-
<Exec Command='"$(SigningToolExe)" sign -i $(TargetPath) -c "$(SigningConfiguration)" -n "WiX Toolset" -d "WiX Toolset" -u https://wixtoolset.org/ -r "$(SigningUser)" -s "$(SigningSecret)"'
122+
<Exec Command='"$(SigningToolExe)" code azure-key-vault $(TargetPath) $(SigningConfiguration)'
131123
WorkingDirectory="$(MSBuildProjectDirectory)" EchoOff="true" />
132124
</Target>
133125

134-
<Target Name="SignNupkg" DependsOnTargets="_GetSignClient" AfterTargets="Pack;PackNative"
135-
Condition=" '$(SigningUser)'!='' and '@(NuGetPackOutput)'!='' and '$(SignNupkg)'!='false' ">
126+
<Target Name="SignNupkg" AfterTargets="Pack;PackNative"
127+
Condition=" '$(SigningCertName)'!='' and '@(NuGetPackOutput)'!='' and '$(SignNupkg)'!='false' ">
136128
<ItemGroup>
137129
<SigningNupkgs Include="@(NuGetPackOutput)" Condition=" '%(Extension)'=='.nupkg' " />
138130
</ItemGroup>
139131

140-
<Message Importance="high" Text="Signing nupkg: @(SigningNupkgs->&apos;%(Identity)&apos;) using configuration from: $(SigningConfiguration)" />
132+
<Message Importance="high" Text="Signing nupkg: @(SigningNupkgs->&apos;%(Identity)&apos;)" />
141133

142-
<Exec Command='"$(SigningToolExe)" sign -i "@(SigningNupkgs->&apos;%(Identity)&apos;)" -c "$(SigningConfiguration)" -f "$(SigningFilelist)" -n "WiX Toolset" -d "WiX Toolset" -u https://wixtoolset.org/ -r "$(SigningUser)" -s "$(SigningSecret)"'
134+
<Exec Command='"$(SigningToolExe)" code azure-key-vault "@(SigningNupkgs->&apos;%(Identity)&apos;)" $(SigningConfiguration)'
143135
WorkingDirectory="$(MSBuildProjectDirectory)" EchoOff="true" />
144136
</Target>
145137

146-
<Target Name="SignBundleEngine" DependsOnTargets="_GetSignClient" Condition=" '$(SigningUser)'!='' and '$(SignOutput)'!='false' ">
147-
<Message Importance="high" Text="Signing bundle engine: @(SignBundleEngine->&apos;%(Identity)&apos;) using configuration from: $(SigningConfiguration)" />
138+
<Target Name="SignBundleEngine" Condition=" '$(SigningCertName)'!='' and '$(SignOutput)'!='false' ">
139+
<Message Importance="high" Text="Signing bundle engine: @(SignBundleEngine->&apos;%(Identity)&apos;)" />
148140

149-
<Exec Command='"$(SigningToolExe)" sign -i "@(SignBundleEngine->&apos;%(Identity)&apos;)" -c "$(SigningConfiguration)" -f "$(SigningFilelist)" -n "WiX Toolset" -d "WiX Toolset" -u https://wixtoolset.org/ -r "$(SigningUser)" -s "$(SigningSecret)"'
141+
<Exec Command='"$(SigningToolExe)" code azure-key-vault "@(SignBundleEngine->&apos;%(Identity)&apos;)" $(SigningConfiguration)'
150142
WorkingDirectory="$(MSBuildProjectDirectory)" EchoOff="true" />
151143
</Target>
152144

153-
<Target Name="SignBundle" DependsOnTargets="_GetSignClient" Condition=" '$(SigningUser)'!='' and '$(SignOutput)'!='false' ">
154-
<Message Importance="high" Text="Signing bundle: @(SignBundle->&apos;%(Identity)&apos;) using configuration from: $(SigningConfiguration)" />
145+
<Target Name="SignBundle" Condition=" '$(SigningCertName)'!='' and '$(SignOutput)'!='false' ">
146+
<Message Importance="high" Text="Signing bundle: @(SignBundle->&apos;%(Identity)&apos;)" />
155147

156-
<Exec Command='"$(SigningToolExe)" sign -i "@(SignBundle->&apos;%(Identity)&apos;)" -c "$(SigningConfiguration)" -f "$(SigningFilelist)" -n "WiX Toolset" -d "WiX Toolset" -u https://wixtoolset.org/ -r "$(SigningUser)" -s "$(SigningSecret)"'
148+
<Exec Command='"$(SigningToolExe)" code azure-key-vault "@(SignBundle->&apos;%(Identity)&apos;)" $(SigningConfiguration)'
157149
WorkingDirectory="$(MSBuildProjectDirectory)" EchoOff="true" />
158150
</Target>
159151

src/internal/SetBuildNumber/SetBuildNumber.proj

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
GitThisAssembly;
2323
SetGlobalJson;
2424
SetDirectoryPackagesProps;
25-
SetOverallWixVersions;
26-
InstallSigningClient
25+
SetOverallWixVersions
2726
</SetBuildNumbersDependsOn>
2827

2928
<GlobalJsonPath>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\..\..\global.json))</GlobalJsonPath>
@@ -106,12 +105,6 @@
106105
</Target>
107106

108107

109-
<Target Name="InstallSigningClient"
110-
DependsOnTargets="_GetSignClient"
111-
Condition=" '$(SigningUser)'!='' ">
112-
</Target>
113-
114-
115108
<Target Name="SetBuildNumbers"
116109
DependsOnTargets="$(SetBuildNumbersDependsOn)"
117110
BeforeTargets="AfterBuild" />

src/signing-empty-file-list.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this-file-prevents-files-from-being-signed-in-nupkgs

src/signing.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)