1 Star 0 Fork 25

iamalec/CloudExplorer-Lite

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build-service-packages.sh 2.32 KB
一键复制 编辑 原始数据 按行查看 历史
ulleo 提交于 2023-04-12 21:47 . feat: md5 check
#!/usr/bin/env bash
declare BUILD_PATH=`pwd`
declare -A f2c_modules
declare -A f2c_moduleNames
function getServices() {
for _dir in $(ls -l services/ |awk '/^d/ {print $NF}')
do
f2c_moduleNames["$_dir"]=$_dir
f2c_modules["$_dir"]=$BUILD_PATH"/services/"$_dir
done
}
function build_services(){
getServices
mkdir -p ${BUILD_PATH}/target/apps/extra
touch ${BUILD_PATH}/target/apps/extra/modules
for build_module_name in "${f2c_moduleNames[@]}"
do
cd ${BUILD_PATH}/target || exit
echo ${build_module_name}
echo ${f2c_modules["$build_module_name"]}
declare APP_NAME=${build_module_name}
declare APP_PORT=`awk '/<service.port>[^<]+<\/service.port>/{gsub(/<service.port>|<\/service.port>/,"",$1);print $1;exit;}' ${f2c_modules["$build_module_name"]}/backend/pom.xml`
declare _APP_VERSION=`ls ${APP_NAME}-*.jar`
_APP_VERSION=${_APP_VERSION//.jar/}
_APP_VERSION=${_APP_VERSION//$APP_NAME-/}
echo "APP: $APP_NAME PORT: $APP_PORT APP_VERSION: $_APP_VERSION"
echo "${APP_NAME}|${APP_PORT}|${_APP_VERSION}" >> ${BUILD_PATH}/target/apps/extra/modules
cp ${BUILD_PATH}/target/${APP_NAME}-${_APP_VERSION}.jar ${BUILD_PATH}/target/apps/extra
rm -f ${BUILD_PATH}/target/apps/extra/app.yml
cp ${f2c_modules["$build_module_name"]}/${APP_NAME}.yml ${BUILD_PATH}/target/apps/extra/app.yml
cd ${BUILD_PATH}/target/apps/extra || exit
if [[ "$OSTYPE" =~ ^darwin ]]; then
sed -i "" "s/APP_VERSION/${_APP_VERSION}/" app.yml
sed -i "" "s/APP_PORT/${APP_PORT}/" app.yml
else
sed -i "s/APP_VERSION/${_APP_VERSION}/" app.yml
sed -i "s/APP_PORT/${APP_PORT}/" app.yml
fi
mv app.yml ${APP_NAME}-${_APP_VERSION}.yml
mkdir -p ${BUILD_PATH}/target/services
tar czvf ${BUILD_PATH}/target/services/${APP_NAME}-${_APP_VERSION}.tar.gz ${APP_NAME}-${_APP_VERSION}.yml ${APP_NAME}-${_APP_VERSION}.jar
md5sum -b ${BUILD_PATH}/target/services/${APP_NAME}-${_APP_VERSION}.tar.gz | awk '{print $1}' > ${BUILD_PATH}/target/services/${APP_NAME}-${_APP_VERSION}.tar.gz.md5
done
tar czvf ${BUILD_PATH}/target/services/all-services-${_APP_VERSION}.tar.gz *.yml *.jar modules
md5sum -b ${BUILD_PATH}/target/services/all-services-${_APP_VERSION}.tar.gz | awk '{print $1}' > ${BUILD_PATH}/target/services/all-services-${_APP_VERSION}.tar.gz.md5
}
build_services
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/iamalec/CloudExplorer-Lite.git
git@gitee.com:iamalec/CloudExplorer-Lite.git
iamalec
CloudExplorer-Lite
CloudExplorer-Lite
main

搜索帮助