update-api-version.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env bash
  2. function line()
  3. {
  4. echo "----------------------------"
  5. }
  6. version=$@
  7. if [[ $version == "" ]]; then
  8. echo "milvus/proto/go-api version not provided"
  9. line
  10. echo "example:"
  11. echo " make update-milvus-api PROTO_API_VERSION=v2.3.0-dev.1"
  12. echo "test with untagged commit:"
  13. echo " make update-milvus-api PROTO_API_VERSION=\${commitID}"
  14. line
  15. exit 1
  16. fi
  17. commitID=$(git ls-remote https://github.com/milvus-io/milvus-proto.git refs/tags/${version} | cut -f 1)
  18. line
  19. echo "Update the milvus-proto/go-api/v2@${version}"
  20. if [[ $commitID == "" ]]; then
  21. echo "${version} is not a valid tag, try to use it as commit ID"
  22. commitID=$version
  23. go get -u github.com/milvus-io/milvus-proto/go-api/v2@$commitID
  24. else
  25. go get -u github.com/milvus-io/milvus-proto/go-api/v2@$version
  26. fi
  27. SCRIPTS_DIR=$(dirname "$0")
  28. EXAMPLE_DIR=$SCRIPTS_DIR/../cmake_build/thirdparty/protobuf/protobuf-src/examples
  29. rm -rf $EXAMPLE_DIR
  30. go mod tidy
  31. line echo "Update the milvus-proto repo"
  32. THIRD_PARTY_DIR=$SCRIPTS_DIR/../cmake_build/thirdparty
  33. pushd $THIRD_PARTY_DIR/milvus-proto
  34. git fetch
  35. git checkout -b $version $commitID
  36. popd