Skip to content

Commit c9ea27b

Browse files
committed
Make certificate provisioning more reliable
1 parent 62501e4 commit c9ea27b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/renotize.nim

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ proc provision*() =
7070
echo "No .cer file found in current directory"
7171
quit(1)
7272

73+
var certFile = ""
74+
for f in certFiles:
75+
if lastPathPart(f) == "developerID_application.cer":
76+
certFile = f
77+
break
78+
if certFile == "":
79+
echo "No developerID_application.cer file found in current directory"
80+
quit(1)
81+
7382
echo "This next step should be completed in the browser."
7483
echo "Press 'Enter' to open the browser and continue."
7584
discard readLine(stdin)
@@ -108,13 +117,13 @@ proc provision*() =
108117
echo "Success!"
109118
echo "You can now sign your app using these two files:"
110119
echo " - private-key.pem"
111-
echo &" - {certFiles[0]}"
120+
echo &" - {certFile}"
112121
echo "You can also use this file to notarize your app:"
113122
echo " - app-store-key.json"
114123

115124
let jsonData = %*{
116125
"privateKey": readFile("private-key.pem").encode(),
117-
"certificate": readFile(certFiles[0]).encode(),
126+
"certificate": readFile(certFile).encode(),
118127
"appStoreKey": readFile("app-store-key.json").encode()
119128
}
120129
writeFile("renotize.json", jsonData.pretty())

0 commit comments

Comments
 (0)