apps-version-check.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. set -euo pipefail
  3. remote="refs/remote/$(git remote -v | grep fetch | grep 'emqx/emqx' | awk '{print $1}')"
  4. latest_release=$(git describe --tags "$(git rev-list --tags --max-count=1 --remotes="$remote")")
  5. bad_app_count=0
  6. while read -r app; do
  7. if [ "$app" != "emqx" ]; then
  8. app_path="$app"
  9. else
  10. app_path="."
  11. fi
  12. src_file="$app_path/src/$(basename "$app").app.src"
  13. old_app_version="$(git show "$latest_release":"$src_file" | grep vsn | grep -oE '"[0-9]+.[0-9]+.[0-9]+"' | tr -d '"')"
  14. now_app_version=$(grep -E 'vsn' "$src_file" | grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"')
  15. if [ "$old_app_version" = "$now_app_version" ]; then
  16. changed="$(git diff --name-only "$latest_release"...HEAD \
  17. -- "$app_path/src" \
  18. -- "$app_path/priv" \
  19. -- "$app_path/c_src" | wc -l)"
  20. if [ "$changed" -gt 0 ]; then
  21. echo "$src_file needs a vsn bump"
  22. bad_app_count=$(( bad_app_count + 1))
  23. fi
  24. fi
  25. done < <(./scripts/find-apps.sh)
  26. if [ $bad_app_count -gt 0 ]; then
  27. exit 1
  28. else
  29. echo "apps version check successfully"
  30. fi