-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
104 lines (93 loc) · 2.95 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: "MacOS sign app action"
description: "Deep sign macOS .app content"
inputs:
plist-path:
description: "The path to the plist file"
required: false
app-path:
description: "The path to the binary to sign"
required: true
mac-keychain-pass:
description: "The password for the keychain"
required: true
mac-application-certkey:
description: "The certificate and key in base64 format"
required: true
mac-certkey-pass:
description: "The password for the certificate and key"
required: true
runs:
using: "composite"
steps:
- name: Check for Keychain
id: check_keychain
shell: bash
run: |
if security list-keychains | grep -q "build.keychain"; then
echo "keychain_exists=true" >> $GITHUB_OUTPUT
else
echo "keychain_exists=false" >> $GITHUB_OUTPUT
fi
- name: Create keychain
if: steps.check_keychain.outputs.keychain_exists == 'false'
shell: bash
run: |
security create-keychain -p "${{ inputs.mac-keychain-pass }}" build.keychain
echo "Keychain created"
security set-keychain-settings -lut 21600 build.keychain
echo "Keychain settings set"
security default-keychain -s build.keychain
echo "Keychain made default"
security unlock-keychain -p "${{ inputs.mac-keychain-pass }}" build.keychain
echo "Keychain unlocked"
- name: Import certificates
shell: bash
run: |
echo "${{ inputs.mac-application-certkey }}" | base64 --decode > application_certkey.p12
security import ./application_certkey.p12 \
-k build.keychain \
-f pkcs12 \
-P "${{ inputs.mac-certkey-pass }}" \
-T /usr/bin/codesign \
-T /usr/bin/productsign
- name: Allow codesign and productsign to use keychain
shell: bash
run: |
security set-key-partition-list \
-S apple-tool:,apple:,codesign:,productsign: \
-s \
-k "${{ inputs.mac-keychain-pass }}" \
build.keychain
- name: Sign contents with entitlements
if: ${{ inputs.plist-path != '' }}
shell: bash
run: |
codesign ${{ inputs.app-path }} \
--sign "Developer ID Application" \
--entitlements ${{ inputs.plist-path }} \
--options runtime \
--force \
--timestamp \
--verbose \
--deep
- name: Sign contents without entitlements
if: ${{ inputs.plist-path == '' }}
shell: bash
run: |
codesign ${{ inputs.app-path }} \
--sign "Developer ID Application" \
--options runtime \
--force \
--timestamp \
--verbose \
--deep
- name: Verify singature
shell: bash
run: |
codesign ${{ inputs.app-path }} \
--display \
--verbose \
-r-
codesign ${{ inputs.app-path }} \
--verify \
--verbose