Skip to content

Commit 90a8f84

Browse files
committed
KX-18441 Fix code signing
1 parent b92e727 commit 90a8f84

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.azuredevops/pipelines/build-and-release.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ stages:
6868
feedsToUse: select
6969
restoreArguments: --locked-mode
7070

71+
- task: GetAzureAuthToken@5
72+
name: KeyVaultToken
73+
displayName: Get token to code signing certificate
74+
inputs:
75+
ServiceConnection: Code signer
76+
AccessScopes: https://vault.azure.net/.default
77+
7178
- task: DotNetCoreCLI@2
7279
displayName: Build
7380
inputs:
@@ -76,7 +83,7 @@ stages:
7683
configuration: ${{ variables.Configuration }}
7784
arguments: --no-restore --verbosity Detailed
7885
env:
79-
AuthenticodeClientSecret: $(AuthenticodeClientSecret)
86+
AuthenticodeAccessToken: $(KeyVaultToken.AuthToken)
8087
# Roll-forward behavior set for AzureSignTool dotnet tool (see .config\dotnet-tools.json) which requires .Net 6.0 runtime
8188
DOTNET_ROLL_FORWARD: Major
8289

@@ -90,6 +97,10 @@ stages:
9097
includesymbols: true
9198
nobuild: false
9299
versioningScheme: off
100+
env:
101+
AuthenticodeAccessToken: $(KeyVaultToken.AuthToken)
102+
# Roll-forward behavior set for AzureSignTool dotnet tool (see .config\dotnet-tools.json) which requires .Net 6.0 runtime
103+
DOTNET_ROLL_FORWARD: Major
93104

94105
- publish: $(System.DefaultWorkingDirectory)/packages
95106
displayName: Publish NuGet package as artifact

Directory.build.targets

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
2-
<Target Name="SignAssemblyWithAuthenticodeSignature" AfterTargets="AfterBuild" Condition="'$(MSBuildProjectFullPath.Contains(&quot;node_modules&quot;))' == 'false' And $(Configuration) == 'Release' And $(SIGN_FILE) != 'false'">
2+
<Target Name="SignAssemblyWithAuthenticodeSignature" AfterTargets="AfterBuild" Condition="'$(MSBuildProjectFullPath.Contains(&quot;node_modules&quot;))' == 'false' And $(Configuration) == 'Release' And $(SIGN_FILE) == 'true'">
33
<PropertyGroup>
44
<XmlSerializersTargetPath>$(TargetDir)$(TargetName).XmlSerializers.dll</XmlSerializersTargetPath>
55
</PropertyGroup>
@@ -8,12 +8,14 @@
88
<AssemblyToSign Include="$(TargetPath)" />
99
<AssemblyToSign Include="$(XmlSerializersTargetPath)" Condition="Exists('$(XmlSerializersTargetPath)')" />
1010
</ItemGroup>
11+
12+
<Exec Command="dotnet AzureSignTool sign --azure-key-vault-url $(AuthenticodeKeyVaultUrl) --azure-key-vault-accesstoken $(AuthenticodeAccessToken) --azure-key-vault-certificate $(AuthenticodeCertificateName) --timestamp-rfc3161 $(TimestampServerUrl) --skip-signed %(AssemblyToSign.Identity)" />
1113
</Target>
1214

1315
<ItemGroup>
1416
<Content Remove="Admin/Client/*.json" />
1517
<Content Remove="Admin/FrontEnd/*.json" />
1618
<Content Remove="Admin/*.json" />
17-
<Content Remove="../Kentico.Xperience.TagManager/*.json"/>
19+
<Content Remove="../Kentico.Xperience.TagManager/*.json"/>
1820
</ItemGroup>
1921
</Project>

0 commit comments

Comments
 (0)