File tree Expand file tree Collapse file tree 1 file changed +39
-21
lines changed Expand file tree Collapse file tree 1 file changed +39
-21
lines changed Original file line number Diff line number Diff line change 7676 - identifier : macOS signing certificate # Text used to identify certificate in notifications.
7777 certificate-secret : INSTALLER_CERT_MAC_P12 # Name of the secret that contains the certificate.
7878 password-secret : INSTALLER_CERT_MAC_PASSWORD # Name of the secret that contains the certificate password.
79+ type : pkcs12
7980
8081 steps :
8182 - name : Set certificate path environment variable
9495 CERTIFICATE_PASSWORD : ${{ secrets[matrix.certificate.password-secret] }}
9596 run : |
9697 (
97- openssl pkcs12 \
98+ openssl ${{ matrix.certificate.type }} \
9899 -in "${{ env.CERTIFICATE_PATH }}" \
99100 -legacy \
100101 -noout \
@@ -121,26 +122,43 @@ jobs:
121122 CERTIFICATE_PASSWORD : ${{ secrets[matrix.certificate.password-secret] }}
122123 id : get-days-before-expiration
123124 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
144162
145163 DAYS_BEFORE_EXPIRATION="$((($(date --utc --date="$EXPIRATION_DATE" +%s) - $(date --utc +%s)) / 60 / 60 / 24))"
146164
You can’t perform that action at this time.
0 commit comments