version-check.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/sh
  2. #
  3. # Licensed to the Apache Software Foundation (ASF) under one or more
  4. # contributor license agreements. See the NOTICE file distributed with
  5. # this work for additional information regarding copyright ownership.
  6. # The ASF licenses this file to You under the Apache License, Version 2.0
  7. # (the "License"); you may not use this file except in compliance with
  8. # the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. ver=$1
  19. red='\e[0;41m'
  20. RED='\e[1;31m'
  21. green='\e[0;32m'
  22. GREEN='\e[1;32m'
  23. NC='\e[0m'
  24. # doc: apisix $ver
  25. matched=`grep "apisix-dashboard-v[0-9][0-9.]*" -r docs/`
  26. expected=`grep "apisix-dashboard-v$ver" -r docs/`
  27. if [ "$matched" = "$expected" ]; then
  28. echo -e "${green}passed: (doc) apisix-dashboard $ver ${NC}"
  29. else
  30. echo -e "${RED}failed: (doc) apisix-dashboard $ver ${NC}" 1>&2
  31. echo
  32. echo "-----maybe wrong version-----"
  33. echo "$matched"
  34. exit 1
  35. fi
  36. matched=`grep "git clone -b v[0-9][0-9.]*" -r docs/`
  37. expected=`grep "git clone -b v$ver" -r docs/`
  38. if [ "$matched" = "$expected" ]; then
  39. echo -e "${green}passed: (doc) apisix-dashboard $ver ${NC}"
  40. else
  41. echo -e "${RED}failed: (doc) apisix-dashboard $ver ${NC}" 1>&2
  42. echo
  43. echo "-----maybe wrong version-----"
  44. echo "$matched"
  45. exit 1
  46. fi
  47. # api VERSION
  48. apiV=`cat api/VERSION`
  49. if [ "$apiV" != "$ver" ]; then
  50. echo -e "${RED}failed: api/VERSION = $apiV not \"$ver\" ${NC}" 1>&2
  51. exit 1
  52. else
  53. echo -e "${green}passed: api/VERSION = $ver ${NC}"
  54. fi
  55. # rockspec
  56. matched=`cat web/package.json | grep version | grep "$ver"`
  57. if [ -z "$matched" ]; then
  58. echo "-----please check version \"$ver\" in web/package.json"
  59. exit 1
  60. else
  61. echo -e "${green}passed: version in web/package.json = $ver ${NC}"
  62. fi