mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 10:46:39 +00:00
feat(notarize): add notarize command to notarize and staple *.dmg files
This commit is contained in:
@@ -46,6 +46,7 @@ func New(version, commit, date string) *CLI {
|
||||
Commands: []*cli2.Command{
|
||||
planCmd(),
|
||||
signCmd(),
|
||||
notarizeCmd(),
|
||||
{
|
||||
Name: "version",
|
||||
Usage: "print the version",
|
||||
|
||||
79
pkg/cli/notarize.go
Normal file
79
pkg/cli/notarize.go
Normal file
@@ -0,0 +1,79 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/jimeh/build-emacs-for-macos/pkg/notarize"
|
||||
"github.com/jimeh/build-emacs-for-macos/pkg/plan"
|
||||
cli2 "github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
func notarizeCmd() *cli2.Command {
|
||||
return &cli2.Command{
|
||||
Name: "notarize",
|
||||
Usage: "notarize and staple a dmg, zip, or pkg",
|
||||
ArgsUsage: "<file>",
|
||||
Flags: []cli2.Flag{
|
||||
&cli2.StringFlag{
|
||||
Name: "bundle-id",
|
||||
Usage: "Bundle",
|
||||
Value: "org.gnu.Emacs",
|
||||
},
|
||||
&cli2.StringFlag{
|
||||
Name: "ac-username",
|
||||
Usage: "Apple Connect username",
|
||||
EnvVars: []string{"AC_USERNAME"},
|
||||
},
|
||||
&cli2.StringFlag{
|
||||
Name: "ac-password",
|
||||
Usage: "Apple Connect password",
|
||||
Value: "@env:AC_PASSWORD",
|
||||
},
|
||||
&cli2.StringFlag{
|
||||
Name: "ac-provider",
|
||||
Usage: "Apple Connect provider",
|
||||
EnvVars: []string{"AC_PROVIDER"},
|
||||
},
|
||||
&cli2.BoolFlag{
|
||||
Name: "staple",
|
||||
Usage: "stable file after notarization",
|
||||
Value: true,
|
||||
},
|
||||
&cli2.StringFlag{
|
||||
Name: "plan",
|
||||
Usage: "path to build plan YAML file produced by " +
|
||||
"emacs-builder plan",
|
||||
Aliases: []string{"p"},
|
||||
EnvVars: []string{"EMACS_BUILDER_PLAN"},
|
||||
TakesFile: true,
|
||||
},
|
||||
},
|
||||
Action: actionWrapper(notarizeAction),
|
||||
}
|
||||
}
|
||||
|
||||
func notarizeAction(c *cli2.Context, opts *Options) error {
|
||||
options := ¬arize.Options{
|
||||
File: c.Args().Get(0),
|
||||
BundleID: c.String("bundle-id"),
|
||||
Username: c.String("ac-username"),
|
||||
Password: c.String("ac-password"),
|
||||
Provider: c.String("ac-provider"),
|
||||
Staple: c.Bool("staple"),
|
||||
}
|
||||
|
||||
if f := c.String("plan"); f != "" {
|
||||
p, err := plan.Load(f)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if p.Output != nil {
|
||||
options.File = filepath.Join(
|
||||
p.Output.Directory, p.Output.DiskImage,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return notarize.Notarize(c.Context, options)
|
||||
}
|
||||
Reference in New Issue
Block a user