fix: 新增自动化apk打包

This commit is contained in:
amzxyz
2025-12-18 15:55:40 +08:00
parent e63b00023b
commit fa455a65a1
9 changed files with 294 additions and 365 deletions

View File

@@ -63,12 +63,14 @@ CHANGES=$(
echo ""
echo "3. **语法模型需单独下载**,并放入输入法用户目录根目录(与方案文件放一起),**无需配置**。"
echo ""
echo "4. 💾 飞机盘下载地址(最快更新):[点击访问](https://share.feijipan.com/s/xiGvXdKz)"
echo "4. **可采用万象提供的更新器完成更新操作[点击跳转下载](https://github.com/amzxyz/RIME-LMDG/releases/tag/tool)"
echo ""
echo "5. Arch Linux 用户 [启用 Arch Linux CN 仓库](https://www.archlinuxcn.org/archlinux-cn-repo-and-mirror/) 后安装。"
echo "5. 💾 飞机盘下载地址(最快更新):[点击访问](https://share.feijipan.com/s/xiGvXdKz)"
echo ""
echo "6. Arch Linux 用户 [启用 Arch Linux CN 仓库](https://www.archlinuxcn.org/archlinux-cn-repo-and-mirror/) 后安装。"
echo " - 基础版包名:\`rime-wanxiang-[拼写方案名]\`,如:自然码方案:\`rime-wanxiang-zrm\`"
echo " - 双拼辅助码增强版包名:\`rime-wanxiang-pro-[拼写方案名]\`,如:自然码方案:\`rime-wanxiang-pro-zrm\`"
echo "6. Deepin Linux v25 用户亦可以通过仓库进行安装。"
echo "7. Deepin Linux v25 用户亦可以通过仓库进行安装。"
echo "### 4. 周边推荐"
echo " - [高度适配万象拼音的仓输入法皮肤](https://github.com/BlackCCCat/ResourceforHamster/tree/main/Skin_Keyboard/)"
echo ""

55
.github/workflows/scripts/openccset.py vendored Normal file
View File

@@ -0,0 +1,55 @@
import os
import json
import subprocess
import sys
def process_opencc():
# 获取路径参数
input_folder = sys.argv[1] if len(sys.argv) > 1 else "./opencc"
if not os.path.exists(input_folder):
print(f"跳过:路径 {input_folder} 不存在")
return
for filename in os.listdir(input_folder):
file_path = os.path.join(input_folder, filename)
# 1. 处理 TXT -> OCD2
if filename.endswith(".txt"):
ocd2_filename = filename.replace(".txt", ".ocd2")
ocd2_path = os.path.join(input_folder, ocd2_filename)
cmd = f'opencc_dict -i "{file_path}" -o "{ocd2_path}" -f text -t ocd2'
try:
subprocess.run(cmd, shell=True, check=True)
print(f"✅ 转换完成: {ocd2_filename}")
os.remove(file_path)
except Exception as e:
print(f"❌ 转换失败: {filename}, {e}")
# 2. 修改 JSON
elif filename.endswith(".json"):
with open(file_path, "r", encoding="utf-8") as f:
try:
data = json.load(f)
except: continue
state = {"modified": False}
def update_json(obj):
if isinstance(obj, dict):
if "type" in obj and obj["type"] == "text":
obj["type"] = "ocd2"
state["modified"] = True
if "file" in obj and obj["file"].endswith(".txt"):
obj["file"] = obj["file"].replace(".txt", ".ocd2")
state["modified"] = True
for key in obj: update_json(obj[key])
elif isinstance(obj, list):
for item in obj: update_json(item)
update_json(data)
if state["modified"]:
with open(file_path, "w", encoding="utf-8") as f:
json.dump(data, f, ensure_ascii=False, indent=2)
print(f"📝 已更新 JSON: {filename}")
if __name__ == "__main__":
process_opencc()