From 7053d2a379d1ab2a8a6ad9338bebb88b47698c5f Mon Sep 17 00:00:00 2001 From: juewuy Date: Tue, 9 Dec 2025 22:22:41 +0800 Subject: [PATCH] =?UTF-8?q?~=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6=E7=BB=93?= =?UTF-8?q?=E6=9E=84=EF=BC=8C=E5=87=86=E5=A4=87=E5=B0=86bin=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=94=BE=E5=88=B0=E5=8D=95=E7=8B=AC=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/bin_update.yml | 43 +++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/.github/workflows/bin_update.yml b/.github/workflows/bin_update.yml index 53a0212..8f46670 100644 --- a/.github/workflows/bin_update.yml +++ b/.github/workflows/bin_update.yml @@ -95,23 +95,38 @@ jobs: curl -kfSL -o mihomo-ruleset.zip https://github.com/DustinWin/ruleset_geodata/archive/refs/heads/mihomo-ruleset.zip curl -kfSL -o sing-box-ruleset.zip https://github.com/DustinWin/ruleset_geodata/archive/refs/heads/sing-box-ruleset.zip + ########################################## # 解压 unzip -o mihomo-ruleset.zip > /dev/null unzip -o sing-box-ruleset.zip > /dev/null - - # 处理 mihomo 规则 - cd ruleset_geodata-mihomo-ruleset - find . -name '*.list' -delete - tar -zcvf mrs.tar.gz . > /dev/null - mv -f mrs.tar.gz ../geodata/ - cd .. - - # 处理 sing-box 规则 - cd ruleset_geodata-sing-box-ruleset - find . -name '*.json' -delete - tar -zcvf srs.tar.gz . > /dev/null - mv -f srs.tar.gz ../geodata/ - cd .. + ########################################## + # 处理 mihomo 规则 (mrs) + if [ -d ruleset_geodata-mihomo-ruleset ]; then + cd ruleset_geodata-mihomo-ruleset + # 删除不需要的 .list + find . -type f -name "*.list" -delete + # 输出文件放到上级目录,避免 tar 自己包含自己 + tar -zcvf ../mrs.tar.gz . > /dev/null + cd .. + else + echo "错误:未找到 ruleset_geodata-mihomo-ruleset" + fi + ########################################## + # 处理 sing-box 规则 (srs) + if [ -d ruleset_geodata-sing-box-ruleset ]; then + cd ruleset_geodata-sing-box-ruleset + # 删除 .json + find . -type f -name "*.json" -delete + # 同样避免目录内生成 tar 导致 file-changed 错误 + tar -zcvf ../srs.tar.gz . > /dev/null + cd .. + else + echo "错误:未找到 ruleset_geodata-sing-box-ruleset" + fi + ########################################## + # 移动到 geodata + mv -f mrs.tar.gz geodata/ + mv -f srs.tar.gz geodata/ # 删除目录 rm -rf ruleset_geodata-mihomo-ruleset