gogio: [macOS] add notarizing

Now, it's possible to notarize the app, using -notaryid,
-notarypass and -notaryteamid flags. Those flags are
similar to -signkey and -signpass.

Signed-off-by: inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
inkeliz
2023-07-11 20:11:57 +01:00
parent 42b1cd0f6c
commit 4128f253e8
4 changed files with 71 additions and 28 deletions
+27 -2
View File
@@ -56,11 +56,17 @@ func buildMac(tmpDir string, bi *buildInfo) error {
}
}
if err := dittozip(tmpDest, finalDest+".zip"); err != nil {
if err := dittozip(tmpDest, tmpDest+".zip"); err != nil {
return err
}
if err := dittounzip(finalDest+".zip", finalDest); err != nil {
if bi.notaryAppleID != "" {
if err := builder.notarize(bi, tmpDest+".zip"); err != nil {
return err
}
}
if err := dittounzip(tmpDest+".zip", finalDest); err != nil {
return err
}
}
@@ -222,6 +228,25 @@ func (b *macBuilder) signProgram(buildInfo *buildInfo, binDest string, name stri
return err
}
func (b *macBuilder) notarize(buildInfo *buildInfo, binDest string) error {
cmd := exec.Command(
"xcrun",
"notarytool",
"submit",
binDest,
"--apple-id", buildInfo.notaryAppleID,
"--team-id", buildInfo.notaryTeamID,
"--wait",
)
if buildInfo.notaryPassword != "" {
cmd.Args = append(cmd.Args, "--password", buildInfo.notaryPassword)
}
_, err := runCmd(cmd)
return err
}
func dittozip(input, output string) error {
cmd := exec.Command("ditto", "-c", "-k", "-X", "--rsrc", input, output)