From cfbae293677917746aff09db3476116fe9653f03 Mon Sep 17 00:00:00 2001 From: V2Ray Date: Wed, 16 Sep 2015 16:30:17 +0200 Subject: [PATCH] release script --- release/release.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 release/release.sh diff --git a/release/release.sh b/release/release.sh new file mode 100755 index 000000000..5bff0195c --- /dev/null +++ b/release/release.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +VERSION=$(sed -n 's/.*Version = \"\([^"]*\)\"*/\1/p' $GOPATH/src/github.com/v2ray/v2ray-core/core.go) + +REL_PATH=$GOPATH/bin/$VERSION +if [ -d "$REL_PATH" ]; then + rm -rf "$REL_PATH" +fi + +mkdir -p $REL_PATH +mkdir -p $REL_PATH/config + +cp -R $GOPATH/src/github.com/v2ray/v2ray-core/release/config/* $REL_PATH/config/ + +function build { + local GOOS=$1 + local GOARCH=$2 + local EXT=$3 + local TARGET=$REL_PATH/v2ray${EXT} + GOOS=${GOOS} GOARCH=${GOARCH} go build -o ${TARGET} -compiler gc github.com/v2ray/v2ray-core/release/server +} + +build "darwin" "amd64" "-macos" +build "windows" "amd64" "-windows-64.exe" +build "linux" "amd64" "-linux-64" +build "linux" "386" "-linux-32" + +ZIP_FILE=$GOPATH/bin/v2ray-$VERSION.zip +if [ -f $ZIP_FILE ]; then + rm -f $ZIP_FILE +fi + +pushd $REL_PATH +zip -r $GOPATH/bin/v2ray-$VERSION.zip * +popd