sign release

This commit is contained in:
Darien Raymond committed 2017-02-23 14:48:44 +01:00
1 parent 2b62de2db6
commit 105b9be608
3 files changed
+41 -16

No files matched your search

+9 -1
View File
@@ -75,11 +75,19 @@ func build(targetOS, targetArch string, archive bool, version string, metadataFi
}
targetFile := getTargetFile(v2rayOS)
err = buildV2Ray(filepath.Join(targetDir, targetFile), version, v2rayOS, v2rayArch)
targetFileFull := filepath.Join(targetDir, targetFile)
err = buildV2Ray(targetFileFull, version, v2rayOS, v2rayArch)
if err != nil {
fmt.Println("Unable to build V2Ray: " + err.Error())
}
if *flagSignBinary {
err := signFile(targetFileFull)
if err != nil {
fmt.Println("Unable to sign V2Ray binary: " + err.Error())
}
}
err = copyConfigFiles(targetDir, v2rayOS)
if err != nil {
fmt.Println("Unable to copy config files: " + err.Error())
+11
View File
@@ -32,3 +32,14 @@ func buildV2Ray(targetFile string, version string, goOS GoOS, goArch GoArch) err
}
return err
}
func signFile(file string) error {
pass := os.Getenv("GPG_SIGN_PASS")
cmd := exec.Command("gpg", "--passphrase", pass, "--output", file+".sig", "--detach-sig", file)
cmd.Env = append(cmd.Env, os.Environ()...)
output, err := cmd.CombinedOutput()
if len(output) > 0 {
fmt.Println(string(output))
}
return err
}