fix: 调整自动化策略
80
.github/workflows/Wanxiang_Matrix.yml
vendored
@@ -49,92 +49,66 @@ jobs:
|
||||
# 垃圾文件过滤
|
||||
DELETE_LIST: ".git .github .gitignore *.md plum weasel.yaml version.txt wanxiang_t9.schema.yaml LICENSE *.png *.jpg unused_folder update_log.txt"
|
||||
run: |
|
||||
# === 0. 准备工作 ===
|
||||
sudo apt-get update && sudo apt-get install -y opencc
|
||||
|
||||
REPO_ROOT="$GITHUB_WORKSPACE/wanxiang_root"
|
||||
RIME_DEST="$GITHUB_WORKSPACE/trime_src/app/src/main/assets/rime"
|
||||
SHARED_DEST="$GITHUB_WORKSPACE/trime_src/app/src/main/assets/shared"
|
||||
SCRIPT_PATH="$GITHUB_WORKSPACE/wanxiang_root/.github/workflows/scripts/openccset.py"
|
||||
DM_PATH="$GITHUB_WORKSPACE/trime_src/app/src/main/java/com/osfans/trime/data/base/DataManager.kt"
|
||||
|
||||
# === 1. 清理目录 ===
|
||||
# 清理目录
|
||||
rm -rf "$RIME_DEST" "$SHARED_DEST"
|
||||
mkdir -p "$RIME_DEST" "$SHARED_DEST"
|
||||
|
||||
# === 2. 拉取方案 ===
|
||||
# 拉取方案
|
||||
git clone -b ${{ matrix.branch }} --single-branch --depth 1 https://github.com/${{ github.repository }}.git temp_scheme
|
||||
|
||||
# === 3. OpenCC 预处理 ===
|
||||
# OpenCC 预处理
|
||||
if [ -d "temp_scheme/opencc" ]; then
|
||||
python3 "$SCRIPT_PATH" "$GITHUB_WORKSPACE/temp_scheme/opencc"
|
||||
fi
|
||||
|
||||
# === 4. 清理垃圾 ===
|
||||
# 从主仓库(wanxiang_root)的 custom 目录拿 zip,解压到 temp_scheme
|
||||
if [ -f "$REPO_ROOT/custom/简纯.zip" ]; then
|
||||
echo ">>> 📦 发现主题包,正在解压到 temp_scheme..."
|
||||
unzip -o "$REPO_ROOT/custom/简纯.zip" -d temp_scheme/
|
||||
fi
|
||||
cd temp_scheme
|
||||
if [ -f "简纯+.trime.yaml" ]; then
|
||||
echo ">>> 🎨 重命名 简纯+.trime.yaml -> trime.yaml"
|
||||
mv -f "简纯+.trime.yaml" "trime.yaml"
|
||||
fi
|
||||
for pattern in ${{ env.DELETE_LIST }}; do rm -rf $pattern || true; done
|
||||
cd ..
|
||||
|
||||
# === 5. 资源分配 ===
|
||||
# 5.1 方案配置 -> Shared
|
||||
cp -rf temp_scheme/* "$SHARED_DEST"/
|
||||
cp -rf temp_scheme/. "$SHARED_DEST"/
|
||||
rm -rf temp_scheme
|
||||
|
||||
# 5.2 物理复制素材 -> Shared
|
||||
if [ -d "wanxiang_root/fonts" ]; then cp -rf "wanxiang_root/fonts" "$SHARED_DEST/"; fi
|
||||
if [ -d "wanxiang_root/backgrounds" ]; then cp -rf "wanxiang_root/backgrounds" "$SHARED_DEST/"; fi
|
||||
|
||||
# 5.3 Gram 模型
|
||||
cp -f "$GITHUB_WORKSPACE/common_assets/wanxiang-lts-zh-hans.gram" "$SHARED_DEST/wanxiang-lts-zh-hans.gram"
|
||||
|
||||
# 5.4 锁定默认主题
|
||||
cd "$SHARED_DEST"
|
||||
THEME_FILE=$(find . -maxdepth 1 -name "*简纯*.yaml" | head -n 1)
|
||||
if [ -n "$THEME_FILE" ]; then
|
||||
echo "🎨 锁定默认主题: $THEME_FILE"
|
||||
mv -f "$THEME_FILE" "trime.yaml"
|
||||
# Gram 模型
|
||||
if [ -f "$GITHUB_WORKSPACE/common_assets/wanxiang-lts-zh-hans.gram" ]; then
|
||||
cp -f "$GITHUB_WORKSPACE/common_assets/wanxiang-lts-zh-hans.gram" "$SHARED_DEST/wanxiang-lts-zh-hans.gram"
|
||||
fi
|
||||
|
||||
# 5.5 深度清理
|
||||
if [ -d "custom" ]; then rm -rf custom/*.jpg custom/*.png custom/*.md 2>/dev/null || true; fi
|
||||
if [ -d "opencc" ]; then rm -rf opencc/*.txt 2>/dev/null || true; fi
|
||||
if [ -d "dicts" ]; then rm -rf dicts/wuzhong.dict.yaml 2>/dev/null || true; fi
|
||||
|
||||
# =======================================================
|
||||
# === [核心逻辑] DataManager.kt 源码注入 ===
|
||||
# =======================================================
|
||||
echo ">>> 🧹 执行深度清理..."
|
||||
# 清理 opencc 里的 txt 源文件 (只留 ocd2)
|
||||
find "$SHARED_DEST/opencc" -name "*.txt" -delete 2>/dev/null || true
|
||||
# 清理不需要的词库
|
||||
rm -f "$SHARED_DEST/dicts/wuzhong.dict.yaml" 2>/dev/null || true
|
||||
# 清理多余的图片 (如果你想清理根目录的)
|
||||
rm -f "$SHARED_DEST/"*.jpg "$SHARED_DEST/"*.png 2>/dev/null || true
|
||||
# DataManager.kt 源码注入
|
||||
echo ">>> [Source] 正在修改 DataManager.kt ..."
|
||||
if [ -f "$DM_PATH" ]; then
|
||||
|
||||
# (1) 修改默认目录名为 wanxiang
|
||||
sed -i 's/File(Environment.getExternalStorageDirectory(), "rime")/File(Environment.getExternalStorageDirectory(), "wanxiang")/g' "$DM_PATH"
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# (2) 注入 Schema List (使用块替换,彻底解决"还是两个"的问题)
|
||||
# -----------------------------------------------------------
|
||||
# (2) 注入 Schema List
|
||||
if [[ "${{ matrix.branch }}" == "wanxiang-base" ]]; then
|
||||
export TARGET_SCHEMA="wanxiang"
|
||||
else
|
||||
export TARGET_SCHEMA="wanxiang_pro"
|
||||
fi
|
||||
|
||||
echo ">>> [Source] 替换 Schema 列表 (Target: $TARGET_SCHEMA)..."
|
||||
|
||||
# 解释:
|
||||
# (\n\s+) -> 捕获第一行前面的换行符和缩进空格 (存入 $1)
|
||||
# - schema: luna_pinyin -> 匹配第一行内容
|
||||
# \n\s+ -> 匹配中间的换行和缩进
|
||||
# - schema: luna_pinyin_simp -> 匹配第二行内容
|
||||
#
|
||||
# 替换结果:$1 (原来的换行和缩进) + "- schema: " + 目标方案
|
||||
# 效果:两行变一行,且缩进完美继承,不用担心格式乱掉。
|
||||
|
||||
perl -i -0777 -pe 's/(\n\s+)- schema: luna_pinyin\n\s+- schema: luna_pinyin_simp/$1- schema: $ENV{TARGET_SCHEMA}/g' "$DM_PATH"
|
||||
|
||||
# -----------------------------------------------------------
|
||||
# (3) 【强力注入】注入防闪退同步代码
|
||||
# -----------------------------------------------------------
|
||||
echo ">>> [Source] 注入防闪退同步代码..."
|
||||
|
||||
# 顺序:Fonts -> Backgrounds -> trime.yaml
|
||||
export INJECT_CODE='
|
||||
try {
|
||||
@@ -146,6 +120,8 @@ jobs:
|
||||
|
||||
// 2. Backgrounds
|
||||
val bd = java.io.File(userDataDir, "backgrounds").apply { mkdirs() }
|
||||
val nomedia = java.io.File(bd, ".nomedia")
|
||||
if (!nomedia.exists()) { nomedia.createNewFile() }
|
||||
am.list("shared/backgrounds")?.forEach { try { ResourceUtils.copyFile("shared/backgrounds/$it", java.io.File(bd, it).absolutePath) } catch(e:Exception){} }
|
||||
} catch(e: Exception) { Timber.e(e, "Assets inject error") }
|
||||
Timber.d("Synced!")'
|
||||
|
||||
|
Before Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
BIN
custom/简纯.zip
Normal file
@@ -27368,6 +27368,7 @@ sort: by_weight
|
||||
都灵 dōu líng 571
|
||||
逗留 dòu liú 574
|
||||
斗六 dòu liù 498
|
||||
都留 dōu liú 495
|
||||
抖搂 dǒu lōu 302
|
||||
抖露 dǒu lù 299
|
||||
斗罗 dòu luó 444
|
||||
@@ -28840,8 +28841,8 @@ sort: by_weight
|
||||
对手 duì shǒu 802
|
||||
对数 duì shù 544
|
||||
对刷 duì shuā 299
|
||||
对谁 duì shuí 587
|
||||
兑水 duì shuǐ 534
|
||||
对谁 duì shuí 487
|
||||
对水 duì shuǐ 478
|
||||
对私 duì sī 399
|
||||
怼死 duì sǐ 353
|
||||
@@ -37989,8 +37990,8 @@ sort: by_weight
|
||||
高洋 gāo yáng 449
|
||||
高扬 gāo yáng 442
|
||||
高氧 gāo yǎng 321
|
||||
高腰 gāo yāo 573
|
||||
膏药 gāo yào 498
|
||||
膏药 gāo yào 573
|
||||
高腰 gāo yāo 498
|
||||
高要 gāo yào 436
|
||||
皋陶 gāo yáo 397
|
||||
高野 gāo yě 499
|
||||
@@ -57270,9 +57271,9 @@ sort: by_weight
|
||||
肩挑 jiān tiāo 366
|
||||
兼祧 jiān tiāo 284
|
||||
剪贴 jiǎn tiē 415
|
||||
舰艇 jiàn tǐng 609
|
||||
监听 jiān tīng 560
|
||||
坚挺 jiān tǐng 556
|
||||
坚挺 jiān tǐng 656
|
||||
监听 jiān tīng 630
|
||||
舰艇 jiàn tǐng 589
|
||||
兼听 jiān tīng 312
|
||||
肩痛 jiān tòng 397
|
||||
兼通 jiān tōng 392
|
||||
@@ -121106,9 +121107,9 @@ sort: by_weight
|
||||
体校 tǐ xiào 509
|
||||
提效 tí xiào 393
|
||||
啼笑 tí xiào 299
|
||||
提携 tí xié 597
|
||||
提些 tí xiē 541
|
||||
题写 tí xiě 528
|
||||
提携 tí xié 507
|
||||
提些 tí xiē 441
|
||||
体协 tǐ xié 395
|
||||
提鞋 tí xié 393
|
||||
提薪 tí xīn 351
|
||||
@@ -125256,6 +125257,7 @@ sort: by_weight
|
||||
推委 tuī wěi 308
|
||||
推文 tuī wén 616
|
||||
推问 tuī wèn 158
|
||||
退我 tuì wǒ 538
|
||||
推我 tuī wǒ 427
|
||||
退伍 tuì wǔ 566
|
||||
腿细 tuǐ xì 439
|
||||
@@ -204082,6 +204084,7 @@ sort: by_weight
|
||||
便打了 biàn dǎ le 96
|
||||
边大龙 biān dà lóng 73
|
||||
变大妈 biàn dà mā 153
|
||||
变大呢 biàn dà ne 382
|
||||
变大时 biàn dà shí 207
|
||||
变大叔 biàn dà shū 158
|
||||
苄达酸 biàn dá suān 61
|
||||
@@ -396364,6 +396367,8 @@ sort: by_weight
|
||||
回应了 huí yìng le 266
|
||||
会赢了 huì yíng le 65
|
||||
会盈利 huì yíng lì 184
|
||||
会赢吗 huì yíng ma 612
|
||||
回应吗 huí yìng ma 443
|
||||
会赢你 huì yíng nǐ 372
|
||||
会影片 huì yǐng piàn 162
|
||||
会萦绕 huì yíng rào 156
|
||||
@@ -558792,7 +558797,6 @@ sort: by_weight
|
||||
其他币 qí tā bì 71
|
||||
其他表 qí tā biǎo 108
|
||||
其他病 qí tā bìng 162
|
||||
其他部 qí tā bù 154
|
||||
其他菜 qí tā cài 316
|
||||
其他茶 qí tā chá 146
|
||||
其他产 qí tā chǎn 100
|
||||
@@ -617933,6 +617937,8 @@ sort: by_weight
|
||||
输了吧 shū le ba 125
|
||||
书了吧 shū le ba 124
|
||||
疏勒城 shū lè chéng 152
|
||||
输了的 shū le de 214
|
||||
熟了的 shú le de 198
|
||||
疏勒国 shū lè guó 134
|
||||
疏勒河 shū lè hé 142
|
||||
熟了后 shú le hòu 166
|
||||
@@ -661683,7 +661689,6 @@ sort: by_weight
|
||||
特说我 tè shuō wǒ 66
|
||||
特斯河 tè sī hé 130
|
||||
特斯拉 tè sī lā 360
|
||||
忒斯拉 tè sī lā 1
|
||||
特斯勒 tè sī lè 89
|
||||
特斯联 tè sī lián 170
|
||||
特斯林 tè sī lín 68
|
||||
@@ -666414,8 +666419,8 @@ sort: by_weight
|
||||
跳绳时 tiào shéng shí 77
|
||||
挑剩下 tiāo shèng xià 111
|
||||
调声音 tiáo shēng yīn 111
|
||||
调试吧 tiáo shì ba 459
|
||||
挑食吧 tiāo shí ba 172
|
||||
调试吧 tiáo shì ba 159
|
||||
条石鲷 tiáo shí diāo 50
|
||||
挑事儿 tiāo shì ér 178
|
||||
调试费 tiáo shì fèi 120
|
||||
@@ -801823,6 +801828,8 @@ sort: by_weight
|
||||
在春天 zài chūn tiān 258
|
||||
在春运 zài chūn yùn 170
|
||||
再次爱 zài cì ài 32
|
||||
再次按 zài cì àn 296
|
||||
在此案 zài cǐ àn 188
|
||||
在此吧 zài cǐ ba 155
|
||||
在此处 zài cǐ chù 265
|
||||
在此次 zài cǐ cì 310
|
||||
@@ -873609,7 +873616,6 @@ sort: by_weight
|
||||
苯甲酸钙 běn jiǎ suān gài 12
|
||||
苯甲酸酐 běn jiǎ suān gān 6
|
||||
苯甲酸汞 běn jiǎ suān gǒng 7
|
||||
苯甲酸号 běn jiǎ suān hào 52
|
||||
苯甲酸钾 běn jiǎ suān jiǎ 5
|
||||
苯甲酸类 běn jiǎ suān lèi 5
|
||||
苯甲酸钠 běn jiǎ suān nà 42
|
||||
@@ -874792,7 +874798,6 @@ sort: by_weight
|
||||
比尔切斯 bǐ ěr qiè sī 10
|
||||
闭耳塞听 bì ěr sāi tīng 10
|
||||
比尔森人 bǐ ěr sēn rén 6
|
||||
比二十四 bǐ èr shí sì 29
|
||||
闭尔通栓 bì ěr tōng shuān 5
|
||||
彼尔维何 bǐ ěr wéi hé 8
|
||||
比尔希略 bǐ ěr xī lüè 5
|
||||
@@ -1087292,8 +1087297,8 @@ sort: by_weight
|
||||
尖端未来 jiān duān wèi lái 7
|
||||
尖端武器 jiān duān wǔ qì 39
|
||||
尖端效应 jiān duān xiào yìng 10
|
||||
简短一点 jiǎn duǎn yì diǎn 46
|
||||
剪短一点 jiǎn duǎn yì diǎn 31
|
||||
简短一点 jiǎn duǎn yì diǎn 26
|
||||
间断运行 jiàn duàn yùn xíng 34
|
||||
尖端装备 jiān duān zhuāng bèi 24
|
||||
尖端作用 jiān duān zuò yòng 1
|
||||
@@ -1227856,6 +1227861,8 @@ sort: by_weight
|
||||
其他币种 qí tā bì zhǒng 33
|
||||
其它病害 qí tā bìng hài 7
|
||||
其他病人 qí tā bìng rén 48
|
||||
其他不懂 qí tā bù dǒng 44
|
||||
其他不动 qí tā bú dòng 29
|
||||
其他部队 qí tā bù duì 41
|
||||
其他部分 qí tā bù fen 58
|
||||
其他部件 qí tā bù jiàn 47
|
||||
@@ -1309796,6 +1309803,7 @@ sort: by_weight
|
||||
属老鼠的 shǔ lǎo shǔ de 22
|
||||
舒乐安定 shū lè ān dìng 30
|
||||
输了比赛 shū le bǐ sài 48
|
||||
输了的人 shū le de rén 31
|
||||
舒了口气 shū le kǒu qì 37
|
||||
疏勒南山 shū lè nán shān 20
|
||||
竖了起来 shù le qǐ lái 33
|
||||
@@ -1316986,6 +1316994,8 @@ sort: by_weight
|
||||
说的是你 shuō de shì nǐ 82
|
||||
说的太多 shuō de tài duō 51
|
||||
说得太多 shuō dé tài duō 40
|
||||
说的太满 shuō de tài mǎn 55
|
||||
说的太慢 shuō de tài màn 32
|
||||
说得太少 shuō dé tài shǎo 32
|
||||
说的挺好 shuō de tǐng hǎo 51
|
||||
说得挺好 shuō de tǐng hǎo 38
|
||||
@@ -1442793,6 +1442803,7 @@ sort: by_weight
|
||||
移步换景 yí bù huàn jǐng 42
|
||||
移步换形 yí bù huàn xíng 25
|
||||
异步回发 yì bù huí fā 19
|
||||
移不回来 yí bù huí lái 47
|
||||
异步获取 yì bù huò qǔ 22
|
||||
衣不及带 yī bù jí dài 7
|
||||
已不记得 yǐ bù jì de 34
|
||||
|
||||
@@ -347008,7 +347008,6 @@ sort: by_weight
|
||||
倒入适量的生抽 dào rù shì liàng de shēng chōu 1
|
||||
道是春归人未归 dào shì chūn guī rén wèi guī 1
|
||||
到时候我去送你 dào shí hou wǒ qù sòng nǐ 1
|
||||
道是无情却有情 dào shì wú qíng què yǒu qíng 1
|
||||
倒数第二次爱情 dào shǔ dì èr cì ài qíng 1
|
||||
倒数第二次恋爱 dào shǔ dì èr cì liàn ài 1
|
||||
导数计时电位法 dǎo shù jì shí diàn wèi fǎ 5
|
||||
|
||||
@@ -244871,8 +244871,6 @@ sort: by_weight
|
||||
道士令严难继和 dào shì lìng yán nán jì hé 1
|
||||
到时若见东篱菊 dào shí ruò jiàn dōng lí jú 1
|
||||
到时疏旷应自适 dào shí shū kuàng yīng zì shì 1
|
||||
道是无情还有情 dào shì wú qíng hái yǒu qíng 1
|
||||
道是无晴还有晴 dào shì wú qíng hái yǒu qíng 1
|
||||
道是无晴却有晴 dào shì wú qíng què yǒu qíng 1
|
||||
到时想得君拈得 dào shí xiǎng de jūn niān dé 1
|
||||
道士写将行气法 dào shì xiě jiāng xíng qì fǎ 1
|
||||
|
||||