apps-version-check.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. set -euo pipefail
  3. latest_release=$(git describe --abbrev=0 --tags)
  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/src" \
  17. -- "$app_path/priv" \
  18. -- "$app_path/c_src" | wc -l)"
  19. if [ "$changed" -gt 0 ]; then
  20. echo "$src_file needs a vsn bump"
  21. bad_app_count=$(( bad_app_count + 1))
  22. fi
  23. fi
  24. done < <(./scripts/find-apps.sh)
  25. if [ $bad_app_count -gt 0 ]; then
  26. exit 1
  27. else
  28. echo "apps version check successfully"
  29. fi