build.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. set -e
  3. export WORKSPACE=$PWD
  4. export PACKAGE_NAME="palm-$VERSION_CODENAME-$GIT_VERSION"
  5. export TARGET_DIR=$WORKSPACE/tmp
  6. function build_dashboard_v4() {
  7. local react_node_modules="node_modules-$2.tar.xz"
  8. if [ ! -f $TARGET_DIR/$react_node_modules ]; then
  9. echo "couldn't find $react_node_modules_tar"
  10. exit 1
  11. fi
  12. cd $TARGET_DIR/mint-$1/dashboard-v4/dashboard/
  13. echo "uncompress node_modules dashboard-v4"
  14. tar xf $TARGET_DIR/$react_node_modules
  15. npm run build
  16. }
  17. # -----------------------------------------------------------------------------
  18. if [ "$#" -ne 2 ]; then
  19. echo "USAGE: $0 FULL_GIT_COMMIT_ID ENV_ID"
  20. exit 1
  21. fi
  22. if [ ! -f $TARGET_DIR/$1.zip ]; then
  23. echo "download $1.zip from github"
  24. wget -q -P $TARGET_DIR https://github.com/iapt-platform/mint/archive/$1.zip
  25. fi
  26. if [ ! -f $TARGET_DIR/$2.env ]; then
  27. echo "couldn't find config file $TARGET_DIR/$2"
  28. exit 1
  29. fi
  30. # export $(grep -v '^#' $TARGET_DIR/$2.env | xargs -0)
  31. source $TARGET_DIR/$2.env
  32. # -----------------------------------------------------------------------------
  33. cd $TARGET_DIR/
  34. if [ -d mint-$1 ]; then
  35. echo "remove mint-$1 folder"
  36. rm -r mint-$1
  37. fi
  38. echo "uncompress $1.zip"
  39. unzip -q $1.zip
  40. build_dashboard_v4 $1 "20241028144559"
  41. echo "done."
  42. exit 0