From 689e266ad9b25a530b9439f9c5682192b7a8a46c Mon Sep 17 00:00:00 2001 From: fxliang Date: Sat, 9 Mar 2024 22:20:41 +0800 Subject: [PATCH] refactor: version info not by rc but build.bat - version number of WeaselServer/WeaselDeployer/WeaselSetup control by ENV variable. - normal build will go product info with commit hash --- .github/workflows/release-ci.yml | 14 +++++++++++++- WeaselDeployer/WeaselDeployer.rc | Bin 24956 -> 25682 bytes WeaselServer/WeaselServer.rc | Bin 13616 -> 14334 bytes WeaselSetup/WeaselSetup.rc | Bin 17028 -> 17458 bytes build.bat | 17 +++++++++++++++++ weasel.props.template | 5 +++++ 6 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml index 4233fc3d9..93b5d9be4 100644 --- a/.github/workflows/release-ci.yml +++ b/.github/workflows/release-ci.yml @@ -92,8 +92,20 @@ jobs: cp ./librime/dist_Win32/lib/rime* ./lib/ cp ./librime/dist_Win32/lib/rime.dll ./output/Win32/ - - name: Build Weasel + - name: Build Weasel Release id: build_weasel + if: startsWith(github.ref, 'refs/tags/') + shell: bash + env: + RELEASE_BUILD: 1 + run: | + ./build.bat data + ./build.bat hant arm64 + ./build.bat installer + + - name: Build Weasel Nightly + id: build_weasel_nightly + if: github.ref == 'refs/heads/master' shell: bash run: | ./build.bat data diff --git a/WeaselDeployer/WeaselDeployer.rc b/WeaselDeployer/WeaselDeployer.rc index 5d43836038e8febb357f1f0175d1d9721cc8c34d..87b1611c7ae8f0e68f9d7a7fa62dbf968876d1a8 100644 GIT binary patch delta 753 zcmex!i1E@1#t921e`7SMS716HTKoMmi z&C9?AW?@$gQ;Dt@q)QoSY97#zOrRYgK12*^&c?NS87D4Ko17Obvv~zmj2g&IlQ}d) z0>cK0iEdsbZ|Vf(uwg%J;1053l$B90HFK*8C)1bfi4O`RSxul=H!dYqLaDw zg(l~@aZMJ{-!XZYDj%~xgVyAWs>-Yi3|b8OlP`vAZvLRpAvO7d3)|#BjCw;Vu)4kQ Y1=c1%vcrlc09#lYYV6!x5Xd6{0GJ_?vj6}9 delta 250 zcmca~g7MEG#t92HyD^?(+$_R8OKtK!%?NG-1|0@N22&tuFuC7H6Pdr6QQMrEUx~qh zK@Y4%55$_h-cNG!26m3gak_k)tMm>qVpY%(v}m%Fq0!_7ZkEXbyegYF8L~)Cexw!6DXn#qYP3|b8O un+t{A1%_TA=`-UFpUD>lCT;f9kRUybu3(1G delta 213 zcmeyDzaeYFg3WG>Iy{pX@kVePFz7HCGMEBMgUQ}}n#lakNBQ)b1(g^K81%qO^uR2G z$&SLho6Uq)F=CYxpDZVGW%3f9Et{W+_VE+8LJhYSTDYyy0b4OyOnTSmd3p()0P;>P AuK)l5 diff --git a/WeaselSetup/WeaselSetup.rc b/WeaselSetup/WeaselSetup.rc index 3082ae8ebe0a1b0896b9cd0d5d58e6414940d785..dd86daff1180f5bfbf85022cdc33379865e8c406 100644 GIT binary patch delta 437 zcmZo^W!%)kIAH<1GD9Xq8bjXX|Hitp3Jl5&DGaGVekMa6kXB#_W(Z*jVu)feV$fiy zV9*4LCD}I#>owqA)#Rmu0T7289W*M8T=UH8GIQW z8N7h(AO;-sTB_2>IOyX`pC;I>$ACKzH z$%VGso6p%?VAO<#fCfVV&^P`JE)1bS_l2NqV9=br(OPu!DZ49^v)K5U^%=A#H?k?S XDllj<=udtqzjd;M(1XoJjzNq7?Oj&a delta 130 zcmdng!PwHuIAOtNC&oJ#ll`nBcnukJ7!07;aPn^}RWyk1tP_|-l^8%u6~KyN kq~YX?cDkDl>@G0kkQTHRpKRxFWs(`oWC6|%o1Bc80KFs}vH$=8 diff --git a/build.bat b/build.bat index deb9f22b7..ecdffc05e 100644 --- a/build.bat +++ b/build.bat @@ -10,7 +10,24 @@ if not defined WEASEL_VERSION set WEASEL_VERSION=0.15.0 if not defined WEASEL_BUILD set WEASEL_BUILD=0 if not defined WEASEL_ROOT set WEASEL_ROOT=%CD% +if not defined VERSION_MAJOR set VERSION_MAJOR=0 +if not defined VERSION_MINOR set VERSION_MINOR=15 +if not defined VERSION_PATCH set VERSION_PATCH=0 + +rem get short commmit id of head +for /F %%i in ('git rev-parse --short HEAD') do (set commitid=%%i) + +if not defined RELEASE_BUILD ( + if not defined PRODUCT_VERSION set PRODUCT_VERSION="%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH%-%commitid%" +) else ( + if not defined PRODUCT_VERSION set PRODUCT_VERSION="%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH%.0" +) +if not defined FILE_VERSION set FILE_VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH%.0 + + echo WEASEL_VERSION=%WEASEL_VERSION% +echo FILE_VERSION=%FILE_VERSION% +echo PRODUCT_VERSION=%PRODUCT_VERSION% echo WEASEL_BUILD=%WEASEL_BUILD% echo WEASEL_ROOT=%WEASEL_ROOT% echo WEASEL_BUNDLED_RECIPES=%WEASEL_BUNDLED_RECIPES% diff --git a/weasel.props.template b/weasel.props.template index f8c87c856..4aa59156b 100644 --- a/weasel.props.template +++ b/weasel.props.template @@ -18,4 +18,9 @@ true + + + $(PreprocessorDefinitions);VERSION_MAJOR=$(VERSION_MAJOR);VERSION_MINOR=$(VERSION_MINOR);VERSION_PATCH=$(VERSION_PATCH);PRODUCT_VERSION=$(PRODUCT_VERSION);FILE_VERSION=$(FILE_VERSION); + +