publish-parts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. #
  3. # publish-parts - Publish parts of a product
  4. #
  5. function publishParts() {
  6. unset CDPATH
  7. local PARTS="api, app, ui, web"
  8. while [[ $# -gt 0 ]] ; do
  9. arg="$1"
  10. case ${arg} in
  11. --parts)
  12. PARTS="${2}"
  13. shift ; shift
  14. ;;
  15. *)
  16. break
  17. ;;
  18. esac
  19. done
  20. PARTS=$(echo ${PARTS} | tr ',' ' ')
  21. for part in ${PARTS} ; do
  22. [ ! -d "${part}" ] && continue
  23. local files=""
  24. for f in CONFIG/keys.json ${part}/CONFIG/keys.json ${part}/product.json pak.json ; do
  25. [ -f ${f} ] && files="${files} ${f}"
  26. done
  27. eval $(paks/assist/json2env ${files})
  28. cd "./${part}"
  29. echo -e "\nPublish ${part} $*"
  30. if [ -f bin/publish ] ; then
  31. ./bin/publish $*
  32. elif [ -f gulpfile.ts ] ; then
  33. gulp publish $*
  34. elif [ -f main.me ] ; then
  35. me publish
  36. elif [ -f Makefile ] ; then
  37. make publish
  38. fi
  39. [ $? != 0 ] && exit 2
  40. cd ..
  41. done
  42. }
  43. publishParts $*