File tree 1 file changed +39
-21
lines changed
1 file changed +39
-21
lines changed Original file line number Diff line number Diff line change 76
76
- identifier : macOS signing certificate # Text used to identify certificate in notifications.
77
77
certificate-secret : INSTALLER_CERT_MAC_P12 # Name of the secret that contains the certificate.
78
78
password-secret : INSTALLER_CERT_MAC_PASSWORD # Name of the secret that contains the certificate password.
79
+ type : pkcs12
79
80
80
81
steps :
81
82
- name : Set certificate path environment variable
94
95
CERTIFICATE_PASSWORD : ${{ secrets[matrix.certificate.password-secret] }}
95
96
run : |
96
97
(
97
- openssl pkcs12 \
98
+ openssl ${{ matrix.certificate.type }} \
98
99
-in "${{ env.CERTIFICATE_PATH }}" \
99
100
-legacy \
100
101
-noout \
@@ -121,26 +122,43 @@ jobs:
121
122
CERTIFICATE_PASSWORD : ${{ secrets[matrix.certificate.password-secret] }}
122
123
id : get-days-before-expiration
123
124
run : |
124
- EXPIRATION_DATE="$(
125
- (
126
- openssl pkcs12 \
127
- -in "${{ env.CERTIFICATE_PATH }}" \
128
- -clcerts \
129
- -legacy \
130
- -nodes \
131
- -passin env:CERTIFICATE_PASSWORD
132
- ) | (
133
- openssl x509 \
134
- -noout \
135
- -enddate
136
- ) | (
137
- grep \
138
- --max-count=1 \
139
- --only-matching \
140
- --perl-regexp \
141
- 'notAfter=(\K.*)'
142
- )
143
- )"
125
+ if [[ ${{ matrix.certificate.type }} == "pkcs12" ]]; then
126
+ EXPIRATION_DATE="$(
127
+ (
128
+ openssl pkcs12 \
129
+ -in ${{ env.CERTIFICATE_PATH }} \
130
+ -clcerts \
131
+ -legacy \
132
+ -nodes \
133
+ -passin env:CERTIFICATE_PASSWORD
134
+ ) | (
135
+ openssl x509 \
136
+ -noout \
137
+ -enddate
138
+ ) | (
139
+ grep \
140
+ --max-count=1 \
141
+ --only-matching \
142
+ --perl-regexp \
143
+ 'notAfter=(\K.*)'
144
+ )
145
+ )"
146
+ elif [[ ${{ matrix.certificate.type }} == "x509" ]]; then
147
+ EXPIRATION_DATE="$(
148
+ (
149
+ openssl x509 \
150
+ -in ${{ env.CERTIFICATE_PATH }} \
151
+ -noout \
152
+ -enddate
153
+ ) | (
154
+ grep \
155
+ --max-count=1 \
156
+ --only-matching \
157
+ --perl-regexp \
158
+ 'notAfter=(\K.*)'
159
+ )
160
+ )"
161
+ fi
144
162
145
163
DAYS_BEFORE_EXPIRATION="$((($(date --utc --date="$EXPIRATION_DATE" +%s) - $(date --utc +%s)) / 60 / 60 / 24))"
146
164
You can’t perform that action at this time.
0 commit comments