From ceb208813a00fd914ac40f1ca568be91510942f2 Mon Sep 17 00:00:00 2001 From: oopuuu <75833466+oopuuu@users.noreply.github.com> Date: Thu, 20 Mar 2025 19:42:58 +0800 Subject: [PATCH] Update build.sh --- build.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index 9f9bd60..f4ac1cc 100644 --- a/build.sh +++ b/build.sh @@ -1,3 +1,14 @@ +version_file=".version" +if [ ! -f $version_file ]; then echo "v1.0.0" > $version_file; fi + +# 读当前版本并自增 +ver=$(cat $version_file) +major=$(echo $ver | cut -d. -f1 | sed 's/v//') +minor=$(echo $ver | cut -d. -f2) +patch=$(echo $ver | cut -d. -f3) +patch=$((patch + 1)) +new_ver="v${major}.${minor}.${patch}" +echo $new_ver > $version_file cd ./TC1/http_server python ./test.py > web_data.c @@ -6,7 +17,7 @@ cd ../.. mico make clean -mico make TC1@MK3031@moc total +mico make TC1@MK3031@moc total -D__VERSION_FROM_FILE__="\"$(cat .version)\"" cp ./build/TC1\@MK3031\@moc/binary/TC1\@MK3031\@moc.ota.bin ./build/TC1\@MK3031\@moc/binary/ota$(date +%Y%m%d%H%M%S).bin