BASE_DIR="$(pwd)" cd $BASE_DIR git status git pull if [ $? -ne 0 ]; then echo "[ERROR git failed in $BASE_DIR]" exit 3 fi if [ ! -d $BASE_DIR/vue ] then echo "[ERROR] Please run the script in h5app dir." exit 2; fi cd $BASE_DIR/vue echo "[Running] npm run build" npm run build if [ $? -ne 0 ] ; then echo "[ERROR] npm run build failed with $?" exit 2; fi rm -rf $BASR_DIR/deploy mv $BASE_DIR/vue/dist $BASE_DIR/ mv $BASE_DIR/dist $BASE_DIR/deploy cd $BASE_DIR git add deploy git commit -m "$(date) autobuild on fe" git push