Skip to content

Commit

Permalink
refactor: version info not by rc but build.bat
Browse files Browse the repository at this point in the history
- version number of WeaselServer/WeaselDeployer/WeaselSetup control by ENV variable.
- normal build will go product info with commit hash
  • Loading branch information
fxliang committed Mar 12, 2024
1 parent 01803fb commit 689e266
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified WeaselDeployer/WeaselDeployer.rc
Binary file not shown.
Binary file modified WeaselServer/WeaselServer.rc
Binary file not shown.
Binary file modified WeaselSetup/WeaselSetup.rc
Binary file not shown.
17 changes: 17 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Expand Down
5 changes: 5 additions & 0 deletions weasel.props.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@
<EnvironmentVariable>true</EnvironmentVariable>
</BuildMacro>
</ItemGroup>
<ItemDefinitionGroup>
<ResourceCompile>
<PreprocessorDefinitions>$(PreprocessorDefinitions);VERSION_MAJOR=$(VERSION_MAJOR);VERSION_MINOR=$(VERSION_MINOR);VERSION_PATCH=$(VERSION_PATCH);PRODUCT_VERSION=$(PRODUCT_VERSION);FILE_VERSION=$(FILE_VERSION);</PreprocessorDefinitions>
</ResourceCompile>
</ItemDefinitionGroup>
</Project>

0 comments on commit 689e266

Please sign in to comment.