ShellCrash/.github/workflows/bin_update.yml
juewuy a2a245bbd0 ~增加更多的本地面板选择
~修复IP地址库判定问题
~增加基于doh的默认dns配置
2022-05-29 11:42:48 +08:00

114 lines
3.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: bin_update
on:
# release:
# types: [published]
# push:
# tags:
# - 'v*'
# branches:
# - master
schedule:
- cron: 0 1 * * 2
# watch:
# types: [started]
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@master
- name: Apt Update
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update
sudo apt-get -y install unzip curl git tar
- name: Update Dashboard
run: |
cd \bin
echo 下载官方面板
curl -kfSL -o clashdb.zip https://github.com/Dreamacro/clash-dashboard/archive/gh-pages.zip
echo 下载Meta面板
curl -kfSL -o meta_db.zip https://github.com/MetaCubeX/clash-dashboard/archive/gh-pages.zip
echo 下载yacd面板
curl -kfSL -o yacd.zip https://github.com/haishanh/yacd/archive/gh-pages.zip
echo 下载meta魔改yacd面板
curl -kfSL -o meta_yacd.zip https://github.com/MetaCubeX/yacd/archive/gh-pages.zip
echo 解压缩
unzip -o clashdb.zip > /dev/null
unzip -o yacd.zip > /dev/null
cd \clash-dashboard-gh-pages
tar -zcvf clashdb.tar.gz * > /dev/null
mv -f clashdb.tar.gz ../
cd ..
cd \yacd-gh-pages
echo yacd特殊处理
find -name '*.map' | xargs rm -rf
rm -rf report.html
tar -zcvf yacd.tar.gz * > /dev/null
mv -f yacd.tar.gz ../
cd ..
echo 解压缩
unzip -o meta_db.zip > /dev/null
unzip -o meta_yacd.zip > /dev/null
cd \clash-dashboard-gh-pages
tar -zcvf meta_db.tar.gz * > /dev/null
mv -f meta_db.tar.gz ../
cd ..
cd \yacd-gh-pages
echo yacd特殊处理
find -name '*.map' | xargs rm -rf
rm -rf report.html
tar -zcvf meta_yacd.tar.gz * > /dev/null
mv -f meta_yacd.tar.gz ../
cd ..
rm -rf clashdb.zip
rm -rf yacd.zip
rm -rf meta_db.zip
rm -rf meta_yacd.zip
rm -rf \clash-dashboard-gh-pages
rm -rf \yacd-gh-pages
echo 面板更新完成!
- name: Update GeoIP
run: |
cd \bin
source version
curl -kfSL -O https://cdn.jsdelivr.net/gh/alecthw/mmdb_china_ip_list@release/Country.mmdb
curl -kfSL -o cn_mini.mmdb https://cdn.jsdelivr.net/gh/Hackl0us/GeoIP2-CN@release/Country.mmdb
curl -kfSL -o china_ip_list.txt https://cdn.jsdelivr.net/gh/17mon/china_ip_list@master/china_ip_list.txt
curl -kfSL -O https://cdn.jsdelivr.net/gh/P3TERX/ca-certificates.crt@download/ca-certificates.crt
curl -kfSL -O https://cdn.jsdelivr.net/gh/Loyalsoldier/v2ray-rules-dat@release/geosite.dat
sed -i '/GeoIP_v*/'d version
echo GeoIP_v=`date '+%Y%m%d'` >> version
echo IP数据库及根证书文件更新完成
- name: Update Core Version Info
run: |
chmod -R +x bin/clash*/
sed -i "s/meta_v=.*/meta_v=$(./bin/clash.meta/clash-linux-amd64 -v 2>/dev/null | sed 's/ linux.*//;s/.* //')/" bin/version
sed -i "s/clashnet_v=.*/clashnet_v=$(./bin/clash.net/clash-linux-amd64 -v 2>/dev/null | sed 's/ linux.*//;s/.* //')/" bin/version
sed -i "s/clash_v=.*/clash_v=$(./bin/clash/clash-linux-amd64 -v 2>/dev/null | sed 's/ linux.*//;s/.* //')/" bin/version
sed -i "s/clashpre_v=.*/clashpre_v=$(./bin/clashpre/clash-linux-amd64 -v 2>/dev/null | sed 's/ linux.*//;s/.* //')/" bin/version
- name: Commit and push
run: |
git config --global user.email "juewuy@gmail.com" && git config --global user.name "Bot"
git add . && git commit -m "自动更新最新Dashboard、地址库、根证书以及内核版本信息" || exit 0
git push
- name: Cleanup Workflow
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 1
keep_minimum_runs: 3