v2ray-core/tools/release/make-release.sh

42 lines
928 B
Bash
Raw Normal View History

2016-07-27 17:50:24 +02:00
#!/bin/bash
VER=$1
2017-02-23 16:44:59 +01:00
PRE=$2
PROJECT=$3
2016-07-27 17:50:24 +02:00
2017-02-23 16:44:59 +01:00
if [ -z "$PRE" ]; then
PRE="true"
2016-07-27 17:50:24 +02:00
fi
2017-02-23 16:45:55 +01:00
if [ -z "$PROJECT" ]; then
echo "Project not specified. Exiting..."
exit 0
fi
2016-07-27 17:50:24 +02:00
echo Creating a new release: $VER: $MSG
IFS="." read -a PARTS <<< "$VER"
MAJOR=${PARTS[0]}
MINOR=${PARTS[1]}
MINOR=$((MINOR+1))
VERN=${MAJOR}.${MINOR}
2016-08-20 20:55:45 +02:00
pushd $GOPATH/src/v2ray.com/core
2016-07-27 17:50:24 +02:00
echo "Adding a new tag: " "v$VER"
2017-02-23 16:44:59 +01:00
git tag -s -a "v$VER" -m "Version ${VER}"
2016-07-27 17:50:24 +02:00
sed -i '' "s/\(version *= *\"\).*\(\"\)/\1$VERN\2/g" core.go
2016-08-01 17:50:55 +02:00
echo "Commiting core.go (may not necessary)"
2016-08-07 17:13:18 +02:00
git commit core.go -S -m "Update version"
2016-07-27 17:50:24 +02:00
echo "Pushing changes"
git push --follow-tags
2017-02-23 16:44:59 +01:00
popd
echo "Launching build machine."
DIR="$(dirname "$0")"
gcloud compute instances create "build-upload" \
--machine-type=n1-highcpu-2 \
--metadata=release_tag=v${VER},prerelease=${PRE} \
--metadata-from-file=startup-script=${DIR}/release-ci.sh \
--zone=us-west1-a \
--project ${PROJECT}