You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
#该脚本为私有化脚本,打包成内含网页的product-report-starter放在内网私服
|
|
|
|
|
|
|
|
|
|
echo 'choose deploy type [1/2]'
|
|
|
|
|
echo '1:deploy snapshot'
|
|
|
|
|
echo '2:deploy release'
|
|
|
|
|
read choose
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#判断node.js mvn是否存在
|
|
|
|
|
command -v npm >/dev/null 2>&1 || { echo >&2 "I require node.js v14.16.0+ but it's not installed. Aborting."; sleep 5; exit 1; }
|
|
|
|
|
command -v mvn >/dev/null 2>&1 || { echo >&2 "I require maven 3.5 + but it's not installed. Aborting."; sleep 5; exit 1; }
|
|
|
|
|
|
|
|
|
|
cd `dirname $0`
|
|
|
|
|
BuildDir=`pwd` #工程根目录
|
|
|
|
|
|
|
|
|
|
#重置pom和index.js
|
|
|
|
|
cat $BuildDir/build/index.js > $BuildDir/report-ui/config/index.js
|
|
|
|
|
cat $BuildDir/build/pom.xml > $BuildDir/report-core/pom.xml
|
|
|
|
|
|
|
|
|
|
echo "build web"
|
|
|
|
|
cd $BuildDir/report-ui
|
|
|
|
|
rm -rf dist
|
|
|
|
|
npm install >/dev/null 2>&1
|
|
|
|
|
npm run build:prod
|
|
|
|
|
|
|
|
|
|
echo "publish web to springboot src/main/resources/static"
|
|
|
|
|
rm -rf $BuildDir/report-core/src/main/resources/static
|
|
|
|
|
mkdir -p $BuildDir/report-core/src/main/resources/static
|
|
|
|
|
mv $BuildDir/report-ui/dist/* $BuildDir/report-core/src/main/resources/static/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "build springboot"
|
|
|
|
|
cd $BuildDir/report-core
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ $choose = '2' ]; then
|
|
|
|
|
mvn clean deploy -DskipTests -DaltDeploymentRepository=nexus-releases::default::http://10.108.10.53:8081/repository/maven-releases
|
|
|
|
|
else
|
|
|
|
|
mvn clean deploy -DskipTests -DaltDeploymentRepository=nexus-snapshots::default::http://10.108.10.53:8081/repository/maven-snapshots
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
rm -rf $BuildDir/report-core/src/main/resources/static
|
|
|
|
|
git reset --hard
|