Skip to content

Commit 07c8117

Browse files
authored
Add support for ClickOnce (#54)
* Add support for ClickOnce * Fix formatting in README
1 parent 964f905 commit 07c8117

File tree

2 files changed

+70
-2
lines changed

2 files changed

+70
-2
lines changed

README.md

+42-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run: dotnet build --configuration Release --no-restore WpfApp
3939

4040
- name: Sign files with Trusted Signing
41-
uses: azure/trusted-signing-action@v0.4.0
41+
uses: azure/trusted-signing-action@v0.5.0
4242
with:
4343
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
4444
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
@@ -279,6 +279,15 @@ pkcs7-oid: 1.3.6.1.5.5.7.3.3
279279
enhanced-key-usage: 1.3.6.1.5.5.7.3.3
280280
```
281281
282+
### ClickOnce
283+
```yaml
284+
# The application name for any ClickOnce files being signed.
285+
clickonce-application-name: My ClickOnce application name.
286+
287+
# The publisher name for any ClickOnce files being signed.
288+
clickonce-publisher-name: My ClickOnce publisher name.
289+
```
290+
282291
### Miscellaneous
283292
```yaml
284293
# The number of seconds that the Trusted Signing service will wait for all files to be signed before it exits. The default value is 300 seconds.
@@ -295,6 +304,38 @@ trace: false
295304
```
296305
297306
## Best Practices
307+
### ClickOnce
308+
Generally you will want to sign an entire package and all its contents i.e. the deployment manifest (`.application` or `.vsto`), application manifest (`.exe.manifest` or `.dll.manifest`) and the underlying `.exe` and `.dll` files themselves. To do this, ensure that the entire contents of the package are available (i.e. the whole `publish` folder from your build) and pass the deployment manifest (`.application` or `.vsto`) as the file to sign - the rest of the files will be detected and signed in the proper order automatically.
309+
310+
In the example below, it is only necessary to pass `ClickOnceApp.application` and `setup.exe` to the Trusted Signing Action. The remaining "Application Files" will be signed automatically.
311+
312+
```txt
313+
C:\TEST\ASSETS\SAMPLE-FILES\CLICKONCE
314+
│ ClickOnceApp.application
315+
│ setup.exe
316+
└───Application Files
317+
└───ClickOnceApp_1_0_0_0
318+
ClickOnceApp.deps.json.deploy
319+
ClickOnceApp.dll.deploy
320+
ClickOnceApp.dll.manifest
321+
ClickOnceApp.exe.deploy
322+
ClickOnceApp.runtimeconfig.json.deploy
323+
Launcher.exe.deploy
324+
```
325+
326+
The following inputs are ignored when signing ClickOnce files:
327+
- `append-signature`
328+
- `generate-digest-path`
329+
- `generate-digest-xml`
330+
- `ingest-digest-path`
331+
- `sign-digest`
332+
- `generate-page-hashes`
333+
- `suppress-page-hashes`
334+
- `generate-pkcs7`
335+
- `pkcs7-options`
336+
- `pkcs7-oid`
337+
- `enhanced-key-usage`
338+
298339
### Timestamping
299340
The files must be signed with timestamping enabled in order for the signatures to be valid for longer than 3 days. It is recommended to use the Trusted Signing timestamp server:
300341
```yaml

action.yml

+28-1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ inputs:
191191
description: A boolean value (true/false) that controls trace logging. The default value is false.
192192
required: false
193193
default: 'false'
194+
clickonce-application-name:
195+
description: The application name for any ClickOnce files being signed.
196+
required: false
197+
clickonce-publisher-name:
198+
description: The publisher name for any ClickOnce files being signed.
199+
required: false
194200

195201
runs:
196202
using: 'composite'
@@ -202,9 +208,10 @@ runs:
202208
$defaultPath = $env:PSModulePath -split ';' | Select-Object -First 1
203209
"PSMODULEPATH=$defaultPath" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
204210
205-
"TRUSTED_SIGNING_MODULE_VERSION=0.4.1" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
211+
"TRUSTED_SIGNING_MODULE_VERSION=0.5.0" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
206212
"BUILD_TOOLS_NUGET_VERSION=10.0.22621.3233" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
207213
"TRUSTED_SIGNING_NUGET_VERSION=1.0.53" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
214+
"DOTNET_SIGNCLI_NUGET_VERSION=0.9.1-beta.24469.1" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
208215
209216
- name: Cache TrustedSigning PowerShell module
210217
id: cache-module
@@ -236,6 +243,16 @@ runs:
236243
key: Microsoft.Trusted.Signing.Client-${{ steps.set-variables.outputs.TRUSTED_SIGNING_NUGET_VERSION }}
237244
if: ${{ inputs.cache-dependencies == 'true' }}
238245

246+
- name: Cache SignCli NuGet package
247+
id: cache-signcli
248+
uses: actions/cache@v4
249+
env:
250+
cache-name: cache-signcli
251+
with:
252+
path: ~\AppData\Local\TrustedSigning\sign\sign.${{ steps.set-variables.outputs.DOTNET_SIGNCLI_NUGET_VERSION }}
253+
key: SignCli-${{ steps.set-variables.outputs.DOTNET_SIGNCLI_NUGET_VERSION }}
254+
if: ${{ inputs.cache-dependencies == 'true' }}
255+
239256
- name: Install Trusted Signing module
240257
shell: 'pwsh'
241258
run: |
@@ -452,5 +469,15 @@ runs:
452469
}
453470
}
454471
472+
$clickOnceApplicationName = "${{ inputs.clickonce-application-name }}"
473+
if (-Not [string]::IsNullOrWhiteSpace($clickOnceApplicationName)) {
474+
$params["ClickOnceApplicationName"] = $clickOnceApplicationName
475+
}
476+
477+
$clickOncePublisherName = "${{ inputs.clickonce-publisher-name }}"
478+
if (-Not [string]::IsNullOrWhiteSpace($clickOncePublisherName)) {
479+
$params["ClickOncePublisherName"] = $clickOncePublisherName
480+
}
481+
455482
Invoke-TrustedSigning @params
456483
shell: pwsh

0 commit comments

Comments
 (0)