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 7777 - identifier : macOS signing certificate # Text used to identify certificate in notifications.
7878 certificate-secret : INSTALLER_CERT_MAC_P12 # Name of the secret that contains the certificate.
7979 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
8081
8182 steps :
8283 - name : Set certificate path environment variable
9596 CERTIFICATE_PASSWORD : ${{ secrets[matrix.certificate.password-secret] }}
9697 run : |
9798 (
98- openssl pkcs12 \
99+ openssl ${{ matrix.certificate.type }} \
99100 -in "${{ env.CERTIFICATE_PATH }}" \
100101 -legacy \
101102 -noout \
@@ -122,26 +123,43 @@ jobs:
122123 CERTIFICATE_PASSWORD : ${{ secrets[matrix.certificate.password-secret] }}
123124 id : get-days-before-expiration
124125 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
145163
146164 DAYS_BEFORE_EXPIRATION="$((($(date --utc --date="$EXPIRATION_DATE" +%s) - $(date --utc +%s)) / 60 / 60 / 24))"
147165
You can’t perform that action at this time.
0 commit comments