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

47 lines
1.1 KiB
Bash
Raw Normal View History

2016-07-27 11:50:24 -04:00
#!/bin/bash
VER=$1
2017-04-24 15:12:31 -04:00
PROJECT=$2
2016-07-27 11:50:24 -04:00
2017-04-24 15:12:31 -04:00
DOTCNT=$(echo $VER | grep -o "\." | wc -l)
if [ "$DOTCNT" -gt 1 ]; then
2017-02-23 10:44:59 -05:00
PRE="true"
2017-04-24 15:12:31 -04:00
else
PRE="false"
2016-07-27 11:50:24 -04:00
fi
2017-02-23 10:45:55 -05:00
if [ -z "$PROJECT" ]; then
echo "Project not specified. Exiting..."
exit 0
fi
2017-04-24 15:12:31 -04:00
echo Creating a new release: $VER
2016-07-27 11:50:24 -04:00
IFS="." read -a PARTS <<< "$VER"
MAJOR=${PARTS[0]}
MINOR=${PARTS[1]}
MINOR=$((MINOR+1))
VERN=${MAJOR}.${MINOR}
2016-08-20 14:55:45 -04:00
pushd $GOPATH/src/v2ray.com/core
2016-07-27 11:50:24 -04:00
echo "Adding a new tag: " "v$VER"
2017-02-23 10:44:59 -05:00
git tag -s -a "v$VER" -m "Version ${VER}"
2016-07-27 11:50:24 -04:00
sed -i '' "s/\(version *= *\"\).*\(\"\)/\1$VERN\2/g" core.go
2016-08-01 11:50:55 -04:00
echo "Commiting core.go (may not necessary)"
2016-08-07 11:13:18 -04:00
git commit core.go -S -m "Update version"
2016-07-27 11:50:24 -04:00
echo "Pushing changes"
git push --follow-tags
2017-02-23 10:44:59 -05:00
popd
echo "Launching build machine."
DIR="$(dirname "$0")"
2017-04-04 17:11:52 -04:00
RAND="$(openssl rand -hex 5)"
gcloud compute instances create "v2raycore-${RAND}" \
2017-02-23 10:44:59 -05:00
--machine-type=n1-highcpu-2 \
--metadata=release_tag=v${VER},prerelease=${PRE} \
--metadata-from-file=startup-script=${DIR}/release-ci.sh \
2017-04-10 17:48:11 -04:00
--zone=us-central1-c \
--project ${PROJECT} \
--scopes "https://www.googleapis.com/auth/compute,https://www.googleapis.com/auth/devstorage.read_write" \