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