File tree 1 file changed +37
-20
lines changed
1 file changed +37
-20
lines changed Original file line number Diff line number Diff line change @@ -124,26 +124,43 @@ jobs:
124
124
CERTIFICATE_PASSWORD : ${{ secrets[matrix.certificate.password-secret] }}
125
125
id : get-days-before-expiration
126
126
run : |
127
- EXPIRATION_DATE="$(
128
- (
129
- openssl pkcs12 \
130
- -in "${{ env.CERTIFICATE_PATH }}" \
131
- -clcerts \
132
- -legacy \
133
- -nodes \
134
- -passin env:CERTIFICATE_PASSWORD
135
- ) | (
136
- openssl x509 \
137
- -noout \
138
- -enddate
139
- ) | (
140
- grep \
141
- --max-count=1 \
142
- --only-matching \
143
- --perl-regexp \
144
- 'notAfter=(\K.*)'
145
- )
146
- )"
127
+ if [[ ${{ matrix.certificate.type }} == "pkcs12" ]]; then
128
+ EXPIRATION_DATE="$(
129
+ (
130
+ openssl pkcs12 \
131
+ -in "${{ env.CERTIFICATE_PATH }}" \
132
+ -clcerts \
133
+ -legacy \
134
+ -nodes \
135
+ -passin env:CERTIFICATE_PASSWORD
136
+ ) | (
137
+ openssl x509 \
138
+ -noout \
139
+ -enddate
140
+ ) | (
141
+ grep \
142
+ --max-count=1 \
143
+ --only-matching \
144
+ --perl-regexp \
145
+ 'notAfter=(\K.*)'
146
+ )
147
+ )"
148
+ elif [[ ${{ matrix.certificate.type }} == "x509" ]]; then
149
+ EXPIRATION_DATE="$(
150
+ (
151
+ openssl x509 \
152
+ -in ${{ env.CERTIFICATE_PATH }} \
153
+ -noout \
154
+ -enddate
155
+ ) | (
156
+ grep \
157
+ --max-count=1 \
158
+ --only-matching \
159
+ --perl-regexp \
160
+ 'notAfter=(\K.*)'
161
+ )
162
+ )"
163
+ fi
147
164
148
165
DAYS_BEFORE_EXPIRATION="$((($(date --utc --date="$EXPIRATION_DATE" +%s) - $(date --utc +%s)) / 60 / 60 / 24))"
149
166
You can’t perform that action at this time.
0 commit comments