-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
84 lines (75 loc) · 2.78 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: "Windows sign action"
description: "Sign Windows installer using DigiCert One Signing Manager"
inputs:
bin-path:
description: "The path to the binary to sign"
required: true
sm-host:
description: "The Signing Manager host"
required: true
sm-api-key:
description: "The Signing Manager API key"
required: true
sm-client-cert-file-b64:
description: "The client certificate file in base64"
required: true
sm-client-cert-password:
description: "The client certificate password"
required: true
sm-code-signing-cert-sha1-hash:
description: "The code signing certificate public SHA1 hash"
required: true
runs:
using: "composite"
steps:
- name: Setup signing certificate
run: |
echo "${{ inputs.sm-client-cert-file-b64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
shell: bash
- name: Set signing variables
id: variables
run: |
echo "SM_HOST=${{ inputs.sm-host }}" >> "$GITHUB_ENV"
echo "SM_API_KEY=${{ inputs.sm-api-key }}" >> "$GITHUB_ENV"
echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
echo "SM_CLIENT_CERT_PASSWORD=${{ inputs.sm-client-cert-password }}" >> "$GITHUB_ENV"
echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH
echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH
echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH
shell: bash
- name: Cache smtools
id: cache-smtools
uses: actions/cache@v3
with:
path: smtools-windows-x64.msi
key: smtools-windows
- name: Download smtools
if: ${{ !steps.cache-smtools.cache-hit }}
run: |
echo cache hit: ${{ steps.cache-smtools.cache-hit }}
curl ^
-X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download ^
-H "x-api-key:${{ inputs.sm-api-key }}" ^
-o smtools-windows-x64.msi
shell: cmd
- name: Setup SSM KSP for signing
run: |
msiexec /i smtools-windows-x64.msi /quiet /qn
smksp_registrar.exe list
smctl.exe keypair ls
C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user
smksp_cert_sync.exe
shell: cmd
- name: Signing using Signtool
run: |
signtool.exe sign `
/sha1 ${{ inputs.sm-code-signing-cert-sha1-hash }} `
/tr http://timestamp.digicert.com `
/td SHA256 `
/fd SHA256 `
${{ inputs.bin-path }}
signtool.exe verify `
/v `
/pa `
${{ inputs.bin-path }}
shell: powershell