1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 18:17:52 -05:00

sign release

This commit is contained in:
Darien Raymond 2017-02-23 14:48:44 +01:00
parent 2b62de2db6
commit 105b9be608
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
3 changed files with 41 additions and 16 deletions

View File

@ -75,11 +75,19 @@ func build(targetOS, targetArch string, archive bool, version string, metadataFi
} }
targetFile := getTargetFile(v2rayOS) 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 { if err != nil {
fmt.Println("Unable to build V2Ray: " + err.Error()) 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) err = copyConfigFiles(targetDir, v2rayOS)
if err != nil { if err != nil {
fmt.Println("Unable to copy config files: " + err.Error()) fmt.Println("Unable to copy config files: " + err.Error())

View File

@ -32,3 +32,14 @@ func buildV2Ray(targetFile string, version string, goOS GoOS, goArch GoArch) err
} }
return 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
}

View File

@ -13,9 +13,14 @@ GITHUB_TOKEN=$(getattr "github_token" "project")
RELEASE_TAG=$(getattr "release_tag" "instance") RELEASE_TAG=$(getattr "release_tag" "instance")
PRERELEASE=$(getattr "prerelease" "instance") PRERELEASE=$(getattr "prerelease" "instance")
DOCKER_HUB_KEY=$(getattr "docker_hub_key" "project") DOCKER_HUB_KEY=$(getattr "docker_hub_key" "project")
SIGN_KEY_PATH=$(getattr "sign_key_path" "project")
SIGN_KEY_PASS=$(getattr "sign_key_pass" "project")
mkdir -p /v2ray/build mkdir -p /v2ray/build
gsutil cp ${SIGN_KEY_PATH} /v2ray/build/sign_key.asc
gpg --import /v2ray/build/sign_key.asc
curl -L -o /v2ray/build/releases https://api.github.com/repos/v2ray/v2ray-core/releases curl -L -o /v2ray/build/releases https://api.github.com/repos/v2ray/v2ray-core/releases
GO_INSTALL=golang.tar.gz GO_INSTALL=golang.tar.gz
@ -35,22 +40,23 @@ popd
go install v2ray.com/core/tools/build go install v2ray.com/core/tools/build
export TRAVIS_TAG=${RELEASE_TAG} export TRAVIS_TAG=${RELEASE_TAG}
export GPG_SIGN_PASS=${SIGN_KEY_PASS}
$GOPATH/bin/build --os=windows --arch=x86 --zip $GOPATH/bin/build --os=windows --arch=x86 --zip --sign
$GOPATH/bin/build --os=windows --arch=x64 --zip $GOPATH/bin/build --os=windows --arch=x64 --zip --sign
$GOPATH/bin/build --os=macos --arch=x64 --zip $GOPATH/bin/build --os=macos --arch=x64 --zip --sign
$GOPATH/bin/build --os=linux --arch=x86 --zip $GOPATH/bin/build --os=linux --arch=x86 --zip --sign
$GOPATH/bin/build --os=linux --arch=x64 --zip $GOPATH/bin/build --os=linux --arch=x64 --zip --sign
$GOPATH/bin/build --os=linux --arch=arm --zip $GOPATH/bin/build --os=linux --arch=arm --zip --sign
$GOPATH/bin/build --os=linux --arch=arm64 --zip $GOPATH/bin/build --os=linux --arch=arm64 --zip --sign
$GOPATH/bin/build --os=linux --arch=mips64 --zip $GOPATH/bin/build --os=linux --arch=mips64 --zip --sign
$GOPATH/bin/build --os=linux --arch=mips64le --zip $GOPATH/bin/build --os=linux --arch=mips64le --zip --sign
$GOPATH/bin/build --os=linux --arch=mips --zip $GOPATH/bin/build --os=linux --arch=mips --zip --sign
$GOPATH/bin/build --os=linux --arch=mipsle --zip $GOPATH/bin/build --os=linux --arch=mipsle --zip --sign
$GOPATH/bin/build --os=freebsd --arch=x86 --zip $GOPATH/bin/build --os=freebsd --arch=x86 --zip --sign
$GOPATH/bin/build --os=freebsd --arch=amd64 --zip $GOPATH/bin/build --os=freebsd --arch=amd64 --zip --sign
$GOPATH/bin/build --os=openbsd --arch=x86 --zip $GOPATH/bin/build --os=openbsd --arch=x86 --zip --sign
$GOPATH/bin/build --os=openbsd --arch=amd64 --zip $GOPATH/bin/build --os=openbsd --arch=amd64 --zip --sign
JSON_DATA=$(printf '{"tag_name": "%s", "prerelease": "%s"}' ${RELEASE_TAG} ${PRERELEASE}) JSON_DATA=$(printf '{"tag_name": "%s", "prerelease": "%s"}' ${RELEASE_TAG} ${PRERELEASE})
RELEASE_ID=$(curl --data "${JSON_DATA}" -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/v2ray/v2ray-core/releases | jq ".id") RELEASE_ID=$(curl --data "${JSON_DATA}" -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/v2ray/v2ray-core/releases | jq ".id")