Skip to content

Commit 752aca5

Browse files
committed
update workflow, we have a certificate and no longer a container for win
1 parent 1ebbd6b commit 752aca5

File tree

1 file changed

+41
-22
lines changed

1 file changed

+41
-22
lines changed

Diff for: .github/workflows/check-certificates.yml

+41-22
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ jobs:
3737
- identifier: macOS signing certificate # Text used to identify certificate in notifications.
3838
certificate-secret: INSTALLER_CERT_MAC_P12 # Name of the secret that contains the certificate.
3939
password-secret: INSTALLER_CERT_MAC_PASSWORD # Name of the secret that contains the certificate password.
40+
type: pkcs12
4041
- identifier: Windows signing certificate
41-
certificate-secret: INSTALLER_CERT_WINDOWS_PFX
42-
password-secret: INSTALLER_CERT_WINDOWS_PASSWORD
42+
certificate-secret: INSTALLER_CERT_WINDOWS_CER
43+
# The password for the Windows certificate is not needed, because its not a container, but a single certificate.
44+
type: x509
4345

4446
steps:
4547
- name: Set certificate path environment variable
@@ -58,7 +60,7 @@ jobs:
5860
CERTIFICATE_PASSWORD: ${{ secrets[matrix.certificate.password-secret] }}
5961
run: |
6062
(
61-
openssl pkcs12 \
63+
openssl ${{ matrix.certificate.type }} \
6264
-in "${{ env.CERTIFICATE_PATH }}" \
6365
-noout -passin env:CERTIFICATE_PASSWORD
6466
) || (
@@ -83,25 +85,42 @@ jobs:
8385
CERTIFICATE_PASSWORD: ${{ secrets[matrix.certificate.password-secret] }}
8486
id: get-days-before-expiration
8587
run: |
86-
EXPIRATION_DATE="$(
87-
(
88-
openssl pkcs12 \
89-
-in "${{ env.CERTIFICATE_PATH }}" \
90-
-clcerts \
91-
-nodes \
92-
-passin env:CERTIFICATE_PASSWORD
93-
) | (
94-
openssl x509 \
95-
-noout \
96-
-enddate
97-
) | (
98-
grep \
99-
--max-count=1 \
100-
--only-matching \
101-
--perl-regexp \
102-
'notAfter=(\K.*)'
103-
)
104-
)"
88+
if [[ ${{ matrix.certificate.type }} == "pkcs12" ]]; then
89+
EXPIRATION_DATE="$(
90+
(
91+
openssl pkcs12 \
92+
-in "${{ env.CERTIFICATE_PATH }}" \
93+
-clcerts \
94+
-nodes \
95+
-passin env:CERTIFICATE_PASSWORD
96+
) | (
97+
openssl x509 \
98+
-noout \
99+
-enddate
100+
) | (
101+
grep \
102+
--max-count=1 \
103+
--only-matching \
104+
--perl-regexp \
105+
'notAfter=(\K.*)'
106+
)
107+
)"
108+
elif [[ ${{ matrix.certificate.type }} == "x509" ]]; then
109+
EXPIRATION_DATE="$(
110+
(
111+
openssl x509 \
112+
-in "${{ env.CERTIFICATE_PATH }}" \
113+
-noout \
114+
-enddate
115+
) | (
116+
grep \
117+
--max-count=1 \
118+
--only-matching \
119+
--perl-regexp \
120+
'notAfter=(\K.*)'
121+
)
122+
)"
123+
fi
105124
106125
DAYS_BEFORE_EXPIRATION="$((($(date --utc --date="$EXPIRATION_DATE" +%s) - $(date --utc +%s)) / 60 / 60 / 24))"
107126

0 commit comments

Comments
 (0)