36
36
- identifier : macOS signing certificate # Text used to identify certificate in notifications.
37
37
certificate-secret : INSTALLER_CERT_MAC_P12 # Name of the secret that contains the certificate.
38
38
password-secret : INSTALLER_CERT_MAC_PASSWORD # Name of the secret that contains the certificate password.
39
+ type : pkcs12
39
40
- identifier : Windows signing certificate
40
- certificate-secret : INSTALLER_CERT_WINDOWS_PFX
41
- password-secret : INSTALLER_CERT_WINDOWS_PASSWORD
41
+ certificate-secret : INSTALLER_CERT_WINDOWS_CER
42
+ # The password for the Windows certificate is not needed, because its not a container, but a single certificate.
43
+ type : x509
42
44
43
45
steps :
44
46
- name : Set certificate path environment variable
57
59
CERTIFICATE_PASSWORD : ${{ secrets[matrix.certificate.password-secret] }}
58
60
run : |
59
61
(
60
- openssl pkcs12 \
62
+ openssl ${{ matrix.certificate.type }} \
61
63
-in "${{ env.CERTIFICATE_PATH }}" \
62
64
-legacy \
63
65
-noout \
@@ -84,26 +86,43 @@ jobs:
84
86
CERTIFICATE_PASSWORD : ${{ secrets[matrix.certificate.password-secret] }}
85
87
id : get-days-before-expiration
86
88
run : |
87
- EXPIRATION_DATE="$(
88
- (
89
- openssl pkcs12 \
90
- -in "${{ env.CERTIFICATE_PATH }}" \
91
- -clcerts \
92
- -legacy \
93
- -nodes \
94
- -passin env:CERTIFICATE_PASSWORD
95
- ) | (
96
- openssl x509 \
97
- -noout \
98
- -enddate
99
- ) | (
100
- grep \
101
- --max-count=1 \
102
- --only-matching \
103
- --perl-regexp \
104
- 'notAfter=(\K.*)'
105
- )
106
- )"
89
+ if [[ ${{ matrix.certificate.type }} == "pkcs12" ]]; then
90
+ EXPIRATION_DATE="$(
91
+ (
92
+ openssl pkcs12 \
93
+ -in "${{ env.CERTIFICATE_PATH }}" \
94
+ -clcerts \
95
+ -legacy \
96
+ -nodes \
97
+ -passin env:CERTIFICATE_PASSWORD
98
+ ) | (
99
+ openssl x509 \
100
+ -noout \
101
+ -enddate
102
+ ) | (
103
+ grep \
104
+ --max-count=1 \
105
+ --only-matching \
106
+ --perl-regexp \
107
+ 'notAfter=(\K.*)'
108
+ )
109
+ )"
110
+ elif [[ ${{ matrix.certificate.type }} == "x509" ]]; then
111
+ EXPIRATION_DATE="$(
112
+ (
113
+ openssl x509 \
114
+ -in "${{ env.CERTIFICATE_PATH }}" \
115
+ -noout \
116
+ -enddate
117
+ ) | (
118
+ grep \
119
+ --max-count=1 \
120
+ --only-matching \
121
+ --perl-regexp \
122
+ 'notAfter=(\K.*)'
123
+ )
124
+ )"
125
+ fi
107
126
108
127
DAYS_BEFORE_EXPIRATION="$((($(date --utc --date="$EXPIRATION_DATE" +%s) - $(date --utc +%s)) / 60 / 60 / 24))"
109
128
0 commit comments