123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- #!/bin/bash
- TARGET=$1
- # 获取最新版本号
- VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)
- if [[ "${VERSION}" = "" ]]
- then
- VERSION=0.0.1-SNAPSHOT
- fi
- if [[ -z ${TARGET} ]]
- then
- # 默认平台
- TARGET=admin
- fi
- rm -rf ${PROJECT_PATH}/dist
- if [[ $TARGET = "admin" ]]
- then
- cd front;
- if [[ $ENV = "test" ]]
- then
- npm run deploy:test ${TARGET}
- elif [[ $ENV = "dev" ]]
- then
- npm run deploy ${TARGET}
- else
- npm run deploy:prod ${TARGET}
- fi
- cd ../;
- # mv admin/dist ./;
- export UPLOAD=front/dist
- export UPLOADED=static-${TARGET}
- elif [[ $TARGET = "www" ]]
- then
- cd front;
- if [[ $ENV = "test" ]]
- then
- npm run deploy:test ${TARGET}
- elif [[ $ENV = "dev" ]]
- then
- npm run deploy ${TARGET}
- else
- npm run deploy:prod ${TARGET}
- fi
- cd ../;
- # mv web/dist ./;
- export UPLOAD=front/dist
- export UPLOADED=static-${TARGET}
- elif [[ $TARGET = "h5" ]]
- then
- cd front;
- if [[ $ENV = "test" ]]
- then
- npm run deploy:test ${TARGET}
- elif [[ $ENV = "dev" ]]
- then
- npm run deploy ${TARGET}
- else
- npm run deploy:prod ${TARGET}
- fi
- cd ../;
- # mv web/dist ./;
- export UPLOAD=front/dist
- export UPLOADED=static-${TARGET}
- elif [[ $TARGET = "gateway" ]]
- then
- rm -rf dist
- mkdir dist
- export ENV=$ENV
- cd server;
- ./gradlew :gateway-api:bootJar
- cd ../
- mv server/gateway-api/build/libs/gateway-api-*-boot.jar dist/gateway-api-boot.jar
- cat server/pm2-gateway-api.json > dist/pm2.json
- chmod +x dist/*
- echo ${VERSION} > dist/LAST_VERSION
- export FORCE_UPLOAD=false
- export UPLOAD=dist
- export UPLOADED="gateway"
- elif [[ $TARGET = "gateway-all" ]]
- then
- rm -rf dist
- mkdir dist
- export ENV=$ENV
- cd server;
- ./gradlew :gateway-api:bootJar
- cd ../
- mv server/gateway-api/build/libs/* dist/
- mv dist/gateway-api-*-boot.jar dist/gateway-api-boot.jar
- cat server/pm2-gateway-api.json > dist/pm2.json
- chmod +x dist/*
- echo ${VERSION} > dist/LAST_VERSION
- export FORCE_UPLOAD=true
- export UPLOAD=dist
- export UPLOADED="gateway"
- fi
|