fix: 解决版本信息获取编译报错,兼容不同格式tag处理

This commit is contained in:
zhanghaochen 2024-06-18 11:36:18 +08:00
parent 26f679b00c
commit 8fce81fd73

View File

@ -31,11 +31,11 @@ spu_version=`git log --decorate -1 | sed -n '1p' | awk '{print substr($2,0)}'`
spu_build_date=`date +"%Y-%m-%d-%H:%M:%S"`
#判断tag是否存在
if [ -z `git log --decorate -1 | grep -oP '(?<=tag: ).*'` ]
if [ -z `git log --decorate -1 | grep -oP '(?<=tag: ).*' | awk '{print substr($1,0)}'` ]
then
spu_tag="NULL";
else
spu_tag=`git log --decorate -1 | grep -oP '(?<=tag: ).*'`
spu_tag=`git log --decorate -1 | grep -oP '(?<=tag: ).*' | awk '{print substr($1,0)}'`
spu_tag=${spu_tag%?}
fi