Skip to content

Commit

Permalink
feat: automatically generate version info
Browse files Browse the repository at this point in the history
  • Loading branch information
kanru committed Dec 21, 2024
1 parent 75f4b47 commit ffa00f9
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 19 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
inputs:
nightly:
description: "Update all submodules to build nightly build"
default: false
default: true
required: false
type: boolean
outputs:
Expand Down Expand Up @@ -54,7 +54,11 @@ jobs:
set VCPKG_ROOT=%VCPKG_INSTALLATION_ROOT%
vcpkg install --triplet x86-windows-static sqlite3
vcpkg install --triplet x64-windows-static sqlite3
- name: Generate nightly version.rs
if: ${{ inputs.nightly }}
run: cargo xtask -y 24 -m 10 -r 0 --nightly

- name: Build
shell: cmd
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
release-build:
uses: ./.github/workflows/ci.yml
with:
nightly: false
code-signing:
needs: [release-build]
uses: ./.github/workflows/code-signing.yml
Expand Down
71 changes: 71 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[workspace]
members = ["libIME", "tsfreg"]
members = ["libIME", "tsfreg", "xtask"]
resolver = "2"
19 changes: 10 additions & 9 deletions ChewingPreferences/ChewingPreferences.rc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ END

#endif // APSTUDIO_INVOKED

#include "../version.rc"

/////////////////////////////////////////////////////////////////////////////
//
Expand All @@ -58,8 +59,8 @@ IDI_ICON ICON "../ChewingTextService/im.chewin
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 24,10,356,0
PRODUCTVERSION 24,10,356,0
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -76,12 +77,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Chewing"
VALUE "FileDescription", "新酷音輸入法設定"
VALUE "FileVersion", "24.10.356.0"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "ChewingPreferences.exe"
VALUE "LegalCopyright", "Copyright (C) 2024"
VALUE "OriginalFilename", "ChewingConfig.rc"
VALUE "OriginalFilename", "ChewingPreferences.exe"
VALUE "ProductName", "新酷音輸入法設定"
VALUE "ProductVersion", "24.10.356.0"
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END
BLOCK "VarFileInfo"
Expand Down Expand Up @@ -194,15 +195,15 @@ END

IDD_ABOUT DIALOGEX 0, 0, 218, 200
STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "關於新酷音輸入法 (24.10.356.0)"
CAPTION ABOUT_CAPTION_WITH_VER
FONT 9, "MS Shell Dlg", 400, 0, 0x88
BEGIN
CONTROL IDB_COOL,IDC_STATIC,"Static",SS_BITMAP,7,7,69,74
LTEXT "題字:翁政銓",IDC_STATIC,7,85,49,8
PUSHBUTTON "確定 (&O)",IDOK,83,178,50,14
LTEXT "新酷音 - 智慧型注音輸入法",IDC_STATIC,84,7,92,8
LTEXT "版本:24.10.356.0",IDC_VERSION,84,20,92,8
LTEXT "發行日期:2024 年 11 月 09 日",IDC_RELEASE_DATE,84,33,100,8
LTEXT ABOUT_VERSION_STR,IDC_VERSION,84,20,92,8
LTEXT ABOUT_RELEASE_DATE_STR,IDC_RELEASE_DATE,84,33,100,8
LTEXT "授權方式:",IDC_STATIC,84,59,35,8
LTEXT "專案首頁:",IDC_STATIC,84,72,35,8
LTEXT "軟體開發者:libchewing 開發團隊",IDC_STATIC,84,46,104,8
Expand Down Expand Up @@ -382,7 +383,7 @@ BEGIN
IDS_SWITCH_SHAPE "全形/半形切換"
IDS_SWITCH_LANG "中文/英文切換"
IDS_SETTINGS "設定/工具選單"
IDS_CONFIG_TITLE "設定新酷音輸入法 (24.10.356.0)"
IDS_CONFIG_TITLE PREFS_TITLE_WITH_VER
END

#endif // Chinese (Traditional, Taiwan) resources
Expand Down
11 changes: 6 additions & 5 deletions ChewingTextService/ChewingTextService.rc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ END

#endif // APSTUDIO_INVOKED

#include "../version.rc"

/////////////////////////////////////////////////////////////////////////////
//
Expand All @@ -67,8 +68,8 @@ IDI_HALF_SHAPE ICON "half.ico"
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 24,10,314,0
PRODUCTVERSION 24,10,314,0
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -85,12 +86,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Chewing"
VALUE "FileDescription", "新酷音輸入法"
VALUE "FileVersion", "24.10.349.0"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "ChewingTextService.dll"
VALUE "LegalCopyright", "Copyright (C) 2013"
VALUE "OriginalFilename", "ChewingTextService.rc"
VALUE "OriginalFilename", "ChewingTextService.dll"
VALUE "ProductName", "新酷音輸入法"
VALUE "ProductVersion", "24.10.349.0"
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END
BLOCK "VarFileInfo"
Expand Down
4 changes: 4 additions & 0 deletions installer/version.wxi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<Include>
<?define Version = "24.10.356.55580"?>
</Include>
6 changes: 4 additions & 2 deletions installer/windows-chewing-tsf.wxs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>

<?include version.wxi?>

<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
<Package Name="新酷音輸入法 (TSF)"
Codepage="65001"
Language="1028"
Manufacturer="新酷音輸入法開發團隊"
Version="24.10.349.0"
Version="$(var.Version)"
UpgradeStrategy="majorUpgrade"
UpgradeCode="8085e4ce-205d-4c44-9450-59ba34163b2a">
<MajorUpgrade AllowDowngrades="yes" />
Expand Down Expand Up @@ -106,4 +108,4 @@
Condition='NSISUNINSTALLCMD64&lt;&gt;""' />
</InstallExecuteSequence>
</Package>
</Wix>
</Wix>
8 changes: 8 additions & 0 deletions version.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#define VER_FILEVERSION 24,10,356,55580
#define VER_FILEVERSION_STR "24.10.356.55580\0"
#define VER_PRODUCTVERSION 24,10,356,55580
#define VER_PRODUCTVERSION_STR "24.10.356.55580\0"
#define ABOUT_CAPTION_WITH_VER "關於新酷音輸入法 (24.10.356.55580)\0"
#define ABOUT_VERSION_STR "版本:24.10.356.55580\0"
#define ABOUT_RELEASE_DATE_STR "發行日期:2024 年 12 月 21 日\0"
#define PREFS_TITLE_WITH_VER "設定新酷音輸入法 (24.10.356.55580)\0"

0 comments on commit ffa00f9

Please sign in to comment.