-
Notifications
You must be signed in to change notification settings - Fork 206
/
main.go
35 lines (30 loc) · 1.32 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Package main implements an OpenPGP-compatible signer for our releases.
// It's ultimately easier to have our own, given a solid upstream library for it,
// than managing cross-platform issues with builds.
package main
import (
"fmt"
"os"
"github.com/thought-machine/please/src/cli"
"github.com/thought-machine/please/tools/release_signer/signer"
)
var opts = struct {
Usage string
Out string `short:"o" long:"output" env:"OUT" description:"Output filename (signature)" required:"true"`
In string `short:"i" long:"input" description:"Input file to sign" required:"true"`
Key string `short:"k" long:"key" env:"PLZ_GPG_KEY" description:"Private ASCII-armoured key file to sign with" required:"true"`
User string `short:"u" long:"user" default:"releases@please.build" description:"User to sign for"`
Password string `short:"p" long:"password" env:"GPG_PASSWORD" required:"true" description:"Password to unlock keyring"`
}{
Usage: `
release_signer is an internal tool used to sign Please releases with.
All it can do is create an ASCII-armoured detached signature for a single file.
`,
}
func main() {
cli.ParseFlagsOrDie("release_signer", &opts)
if err := signer.SignFile(opts.In, opts.Out, opts.Key, opts.User, opts.Password); err != nil {
fmt.Fprintf(os.Stderr, "Signing failed: %s\n", err)
os.Exit(1)
}
}