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