apps-version-check.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. set -euo pipefail
  3. latest_release=$(git describe --tags "$(git rev-list --tags --max-count=1 --remotes=refs/remote/origin)")
  4. bad_app_count=0
  5. while read -r app; do
  6. if [ "$app" != "emqx" ]; then
  7. app_path="$app"
  8. else
  9. app_path="."
  10. fi
  11. src_file="$app_path/src/$(basename "$app").app.src"
  12. old_app_version="$(git show "$latest_release":"$src_file" | grep vsn | grep -oE '"[0-9]+.[0-9]+.[0-9]+"' | tr -d '"')"
  13. now_app_version=$(grep -E 'vsn' "$src_file" | grep -oE '"[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"')
  14. if [ "$old_app_version" = "$now_app_version" ]; then
  15. changed="$(git diff --name-only "$latest_release"...HEAD \
  16. -- "$app_path/etc" \
  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