make-release.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. VER=$1
  3. PROJECT=$2
  4. DOTCNT=$(echo $VER | grep -o "\." | wc -l)
  5. if [ "$DOTCNT" -gt 1 ]; then
  6. PRE="true"
  7. else
  8. PRE="false"
  9. fi
  10. if [ -z "$PROJECT" ]; then
  11. echo "Project not specified. Exiting..."
  12. exit 0
  13. fi
  14. echo Creating a new release: $VER
  15. IFS="." read -a PARTS <<< "$VER"
  16. MAJOR=${PARTS[0]}
  17. MINOR=${PARTS[1]}
  18. MINOR=$((MINOR+1))
  19. VERN=${MAJOR}.${MINOR}
  20. pushd $GOPATH/src/v2ray.com/core
  21. echo "Adding a new tag: " "v$VER"
  22. git tag -s -a "v$VER" -m "Version ${VER}"
  23. sed -i '' "s/\(version *= *\"\).*\(\"\)/\1$VERN\2/g" core.go
  24. echo "Committing core.go (may not necessary)"
  25. git commit core.go -S -m "Update version"
  26. echo "Pushing changes"
  27. git push --follow-tags
  28. popd
  29. pushd $GOPATH/src/v2ray.com/ext
  30. echo "Adding a new tag: " "v$VER" "to ext"
  31. git tag -s -a "v$VER" -m "Version ${VER}"
  32. echo "Pushing changes to ext"
  33. git push --follow-tags
  34. popd
  35. echo "Launching build machine."
  36. DIR="$(dirname "$0")"
  37. RAND="$(openssl rand -hex 5)"
  38. gcloud compute instances create "v2raycore-${RAND}" \
  39. --machine-type=n1-highcpu-2 \
  40. --metadata=release_tag=v${VER},prerelease=${PRE} \
  41. --metadata-from-file=startup-script=${DIR}/release-ci.sh \
  42. --zone=europe-west4-c \
  43. --project ${PROJECT} \
  44. --scopes "https://www.googleapis.com/auth/compute,https://www.googleapis.com/auth/devstorage.read_write" \