Skip to content

Commit 38a8540

Browse files
committed
fix: ci build
1 parent 22f9ce4 commit 38a8540

21 files changed

+104071
-122
lines changed

.github/workflows/build.yml

Lines changed: 56 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2,90 +2,72 @@ name: Build and Release
22

33
on:
44
push:
5-
branches:
6-
- master
75
tags:
86
- '[0-9]+.*'
7+
branches:
8+
- master
9+
paths:
10+
- 'src/**'
11+
- 'radical.schema.yaml'
12+
- 'radical_pinyin.schema.yaml'
13+
14+
# 3. 允许手动触发
915
workflow_dispatch:
10-
# repository_dispatch:
11-
# types: [chaizi_update]
1216

1317
jobs:
1418
build:
15-
runs-on: windows-latest
19+
runs-on: ubuntu-latest
1620

1721
steps:
1822
- name: Checkout
19-
uses: actions/checkout@v4
20-
with:
21-
token: ${{ secrets.TOKEN }}
22-
fetch-depth: '0'
23-
submodules: true
24-
25-
- name: Set up git
26-
run: |
27-
git config --global user.name "github-actions[bot]"
28-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
29-
30-
# - name: Update submodule
31-
# if: github.event_name == 'repository_dispatch'
32-
# run: |
33-
# cd dict
34-
# git checkout master
35-
# git pull
23+
uses: actions/checkout@v6
3624

3725
- name: Update tag
3826
if: startsWith(github.ref, 'refs/tags/')
3927
run: |
40-
$Date = Get-Date -Format yyyy.MM.dd
41-
Write-output "${{ github.ref_name }}"
42-
"# v${{ github.ref_name }} -> $Date" >> 'info.yaml'
43-
(gc radical.schema.yaml -Raw) -replace 'version: "\d\.\d\.\d"',"version: `"${{ github.ref_name }}`"" | Out-File radical.schema.yaml
44-
(gc radical_pinyin.schema.yaml -Raw) -replace 'version: "\d\.\d\.\d"',"version: `"${{ github.ref_name }}`"" | Out-File radical_pinyin.schema.yaml
45-
46-
# - name: Update build branch
47-
# run: |
48-
# $Status = git status --porcelain
49-
# if ( $Status ) {
50-
# "Update submodule"
51-
# $info = (irm https://whatthecommit.com/index.txt).trim()
52-
# git add --all
53-
# git commit -m "$info" && git push origin build
54-
# }
55-
56-
# - name: Set up Python
57-
# uses: actions/setup-python@v5
58-
# with:
59-
# python-version: '3.x'
60-
# cache: 'pip'
28+
DATE=$(date +'%Y.%m.%d')
29+
echo "${{ github.ref_name }}"
30+
31+
# 将版本信息追加到 dict-head-note.yaml
32+
echo "# v${{ github.ref_name }} -> $DATE" >> src/dict/dict-head-note.yaml
33+
34+
# 更新 schema 文件中的版本信息
35+
sed -i "s/version: \"[0-9]\.[0-9]\.[0-9]\"/version: \"${{ github.ref_name }}\"/g" radical.schema.yaml
36+
sed -i "s/version: \"[0-9]\.[0-9]\.[0-9]\"/version: \"${{ github.ref_name }}\"/g" radical_pinyin.schema.yaml
6137
62-
# - name: Build
63-
# run: |
64-
# make
38+
- name: Set up Python
39+
uses: actions/setup-python@v6
40+
with:
41+
python-version: '3.x'
42+
cache: 'pip'
6543

66-
- name: Update
44+
- name: Build
45+
working-directory: ./src
6746
run: |
68-
$ErrorActionPreference = 'Break'
69-
# $CommitInfo = Get-Date -UFormat %s
70-
# $CommitInfo = (irm https://whatthecommit.com/index.txt).trim()
47+
make lint
48+
make
7149
72-
# git checkout master
73-
# cp gen/radical_pinyin.dict.yaml , gen/radical_pinyin.schema.yaml
74-
# cp gen/radical_flypy.dict.yaml, gen/radical.schema.yaml
75-
# $Status = git status --porcelain
76-
# if ( $Status ) {
77-
# "Push to master branch"
78-
# git add --all
79-
# git commit -m "$CommitInfo" && git push origin master
80-
# }
81-
mkdir gen
82-
Compress-Archive "radical_pinyin.schema.yaml","radical_pinyin.dict.yaml" "gen/radical_pinyin.zip"
83-
Compress-Archive "radical_flypy.dict.yaml","radical.schema.yaml" "gen/radical_flypy.zip"
84-
Compress-Archive "lua", "build" "gen/extra.zip"
50+
- name: Push and pack
51+
run: |
52+
set -e
53+
COMMIT_INFO=$(curl -s https://whatthecommit.com/index.txt)
54+
if [ -n "$(git status --porcelain)" ]; then
55+
git config --global user.name "github-actions[bot]"
56+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
57+
echo "Push to changes"
58+
git add --all
59+
git commit -m "$COMMIT_INFO"
60+
git push origin master
61+
else
62+
echo "No changes to commit"
63+
fi
64+
zip radical_pinyin.zip radical_pinyin.schema.yaml radical_pinyin.dict.yaml
65+
zip radical_flypy.zip radical_flypy.dict.yaml radical.schema.yaml
66+
zip -r extra.zip lua build
8567
86-
- name: Create Nightly release
68+
- name: Create nightly release
8769
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
88-
uses: 'softprops/action-gh-release@v2.0.4'
70+
uses: softprops/action-gh-release@v2
8971
with:
9072
body: |
9173
## 文件
@@ -99,25 +81,25 @@ jobs:
9981
generate_release_notes: true
10082
fail_on_unmatched_files: true
10183
files: |
102-
gen/*.zip
84+
radical_pinyin.zip
85+
radical_flypy.zip
86+
extra.zip
10387
104-
- name: Create Stable release
88+
- name: Create stable release
10589
if: startsWith(github.ref, 'refs/tags/')
106-
uses: 'softprops/action-gh-release@v2.0.4'
90+
uses: softprops/action-gh-release@v2
10791
with:
10892
body: |
10993
## 文件
11094
- `radical_pinyin.zip` : 包含全拼双拼的方案和词库
11195
- `radical_flypy.zip`:仅适用于小鹤双拼的方案和词库
11296
- `extra.zip`:辅码反查 lua 和带声调的 build 文件
11397
generate_release_notes: true
114-
draft: true
98+
draft: false
11599
prerelease: false
116100
make_latest: true
117101
fail_on_unmatched_files: true
118102
files: |
119-
gen/*.zip
120-
121-
- name: Error Handling
122-
if: ${{ failure() }}
123-
run: exit 1
103+
radical_pinyin.zip
104+
radical_flypy.zip
105+
extra.zip

.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
.DS_Store
2-
gen/*
32
.vscode
4-
radical.txt
3+
temp.dict.yaml
4+
5+
# Python
6+
bin/
7+
include/
8+
lib/
59
__pycache__
6-
dict
10+
pyvenv.cfg

README.md

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# [RIME](https://rime.im/) 部件拆字 | 拼音输入方案
1+
# [RIME](https://rime.im/) 部件拆字 | 拼音输入方案 & 辅码插件
22

3-
配方:℞ rime-radical-pinyin
3+
`mirtlecn/rime-radical-pinyin`
44

55
[![License: GPL 3.0](https://img.shields.io/badge/license-GPLv3-red)](https://www.gnu.org/licenses/gpl-3.0.txt)
66
[![GitHub Release](https://img.shields.io/github/v/release/mirtlecn/rime-radical-pinyin)](https://github.com/mirtlecn/rime-radical-pinyin/releases/latest)
7-
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/mirtlecn/rime-radical-pinyin/build.yml)](https://github.com/mirtlecn/rime-radical-pinyin/actions/workflows/build.yml)
87

98
<!-- TOC -->
109

@@ -16,7 +15,8 @@
1615
- [作为辅助码(反查候选)挂载](#作为辅助码反查候选挂载)
1716
- [注音](#注音)
1817
- [反查带声调注音](#反查带声调注音)
19-
- [已知问题](#问题)
18+
- [已知问题](#已知问题)
19+
- [Build & Contribute](#contribute)
2020
- [Credit](#credit)
2121

2222
<!-- /TOC -->
@@ -25,15 +25,15 @@
2525

2626
用拼音输入一个汉字的每一个组成部分(偏旁、部首等部件),组合拼出字来,例如输入 `wu niao`(敄 鸟)或者 `mao wen niao`(矛 夂 鸟)得 ``
2727

28-
适配双拼(例图为小鹤双拼)。
28+
适配各类双拼方案(例图为小鹤双拼)。
2929

30-
不适于用作输入常用字的主要翻译器。
30+
不适于用作输入常用字,适于
3131

32-
可以应用于反查,便于打出不清楚读音的生僻字,演示(`禺+页=颙``王+炎=琰``讠+益=谥`):
32+
- 应用于反查,便于打出不清楚读音的生僻字,演示(`禺+页=颙``王+炎=琰``讠+益=谥`):[配置方法](#作为反查方案挂载) -> )
3333

3434
![image](res/reverse.gif)
3535

36-
可以用作辅助码,快速找到候选字词(`镓锗砷锡溴氪铷锶钇锆->钅钅石钅氵气钅钅钅钅`)(使用请参考 [search.lua](search.lua.md)):
36+
- 用作辅助码,快速找到候选字词(`镓锗砷锡溴氪铷锶钇锆->钅钅石钅氵气钅钅钅钅`)([配置方法](search.lua.md) -> ):
3737

3838
![image](res/fuma.gif)
3939

@@ -43,58 +43,50 @@
4343

4444
<details>
4545

46-
<summary>安装 /plum/ </summary>
46+
<summary>请先安装 /plum/</summary>
4747

4848
```bash
49-
# install git first
49+
# 请安装 git
5050

5151
cd ~
5252
git clone https://github.com/rime/plum.git
53-
54-
# use plum install stroke to default location
55-
cd ~/plum
56-
bash rime-install stroke
57-
58-
# or install to a sepcific folder
53+
# 使用 plum
5954
cd ~/plum
60-
rime_dir='D:/RIME' bash rime-install stroke
55+
bash rime-install <recipe_name>
6156
```
6257

6358
</details>
59+
<br>
60+
全拼 / 双拼用户请以下命令按安装:
6461

6562
```bash
6663
# 安装词典文件
67-
bash rime-install mirtlecn/rime-radical-pinyin@master
64+
bash rime-install mirtlecn/rime-radical-pinyin
6865

69-
# 双拼请额外执行
70-
# 请将命令末尾(schema=?)替换为你想要安装的双拼名称,支持
66+
# 若使用双拼,请额外执行
67+
# 将命令末尾(schema=?)替换为你想要安装的双拼名称,支持
7168
# - flypy(小鹤双拼)
7269
# - double_pinyin(自然码双拼)
7370
# - mspy(微软双拼)
7471
# - sogou(搜狗双拼)
7572
# - abc(智能 ABC 双拼)
7673
# - ziguang(紫光双拼)
77-
# - jiajia(家家双拼
74+
# - jiajia(拼音加加
7875

79-
bash rime-install mirtlecn/rime-radical-pinyin@master:config:schema=flypy
76+
bash rime-install mirtlecn/rime-radical-pinyin:config:schema=flypy
8077
```
8178

82-
<details>
83-
84-
<summary>只使用小鹤双拼 --></summary>
79+
如果只使用小鹤双拼,建议使用下面的命令:
8580

8681
```bash
87-
bash rime-install mirtlecn/rime-radical-pinyin@master:flypy
82+
bash rime-install mirtlecn/rime-radical-pinyin:flypy
8883
```
8984

90-
</details>
91-
92-
9385
### 2. 手动安装
9486

9587
前往本仓库的 Release 界面,下载 `radical_pinyin.zip`,解压后复制到 Rime 用户目录。
9688

97-
双拼用户请直接或以打补丁的方式修改方案文件的 algebra 的 __include 部分
89+
双拼用户请直接修改,或以打补丁的方式修改方案文件的 algebra 的 __include 部分
9890

9991
补丁示例:
10092

@@ -192,7 +184,6 @@ recognizer:
192184
以上读音可以同时存在,因而一个部件可能有多种拼法。
193185

194186
- 冂(本音 jiong、助记 tong)
195-
- 一(本音 yi、笔画 heng)
196187

197188
词典文件的开头部分列出了一些注音可供参考。
198189

@@ -203,14 +194,14 @@ recognizer:
203194
plum 安装:
204195

205196
```bash
206-
bash rime-install mirtlecn/rime-radical-pinyin@master:extra
197+
bash rime-install mirtlecn/rime-radical-pinyin:extra
207198
```
208199

209200
若要手动安装,请前往 Release 界面下载 extra.zip,解压后,在其中的 build 文件夹内有以下三个文件:
210201

211-
- `zdict.reverse.bin`:汉典注音,无音者注 `n/a`(推荐)
212202
- `kMandarin.reverse.bin`: 单字注最常用的一到两个读音(推荐)
213-
- `pinyin.reverse.bin`: 单字注所有可能的读音(会包含异体字、通假字等音)
203+
- `zdict.reverse.bin`:注音更全,无音者注 `n/a`
204+
- `pinyin.reverse.bin`: 单字注所有可能的读音(会包含异体字、通假字等音,不推荐)
214205

215206
下载复制进 build 目录后。更改提示码词典指向它们,如下图所示:
216207

@@ -221,18 +212,24 @@ radical_reverse_lookup:
221212
# dictionary: pinyin
222213
```
223214

224-
## 问题
215+
## 已知问题
225216

226-
开启用户词典后,双拼状态下,会产生未被算法转化的含引号全拼编码,出现一些意外候选。简单的解决办法是设定 enable_user_dict 为 false(已经在本方案设定,仍需在主方案中设定)。
217+
**问题:** 对于双拼用户,开启用户词典,会产生未被算法转化的含引号全拼编码,出现一些意外候选。(不影响全拼用户)
227218

228-
也可以自行将词典直接转化为双拼编码,`build` 分支下有示例脚本,Release 界面有生成的词典
219+
**解决方案 1:** 请务必设定 enable_user_dict 为 false(已经在本方案设定,仍需在主方案中设定)
229220

230-
## Credit
221+
**解决方案 2:** 将词典直接转化为双拼编码,`build` 分支下有示例脚本,Release 界面有生成的小鹤双拼词典。
222+
223+
## Contribute
224+
225+
添字、修正拆分等请修改 `src/dict/radical.yaml`。
231226

232-
词典数据:
227+
修改注音,请修改 `src/script/gen_dict.py`。
228+
229+
[源文件和构建说明](./src/README.md)
230+
231+
## Credit
233232

234-
- 汉字拆字字典(@開放詞典 / henrysting / Mirtle CC BY-SA 4.0),转换而成
235-
- https://gitlab.chise.org/CHISE/ids (GPLv2 or later)
236-
- https://github.com/yi-bai/ids (MIT)
233+
©2026 [Mirtle](https://github.com/mirtlecn)
237234

238-
除在文件内另行注明的,本仓库文件均发布在 GPLv3 许可协议下。
235+
GPLv3

0 commit comments

Comments
 (0)