bin_update #102
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: bin_update | |
on: | |
# release: | |
# types: [published] | |
# push: | |
# tags: | |
# - 'v*' | |
# branches: | |
# - master | |
schedule: | |
- cron: 0 9 * * 6 | |
# watch: | |
# types: [started] | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
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/MetaCubeX/metacubexd/archive/gh-pages.zip | |
echo 下载Meta面板 | |
curl -kfSL -o meta_db.zip https://github.com/MetaCubeX/Razord-meta/archive/gh-pages.zip | |
echo 下载meta魔改yacd面板 | |
curl -kfSL -o meta_yacd.zip https://github.com/MetaCubeX/Yacd-meta/archive/gh-pages.zip | |
echo 解压缩 | |
unzip -o clashdb.zip > /dev/null | |
unzip -o meta_db.zip > /dev/null | |
unzip -o meta_yacd.zip > /dev/null | |
cd \metacubexd-gh-pages | |
tar -zcvf clashdb.tar.gz * > /dev/null | |
mv -f clashdb.tar.gz ../ | |
cd .. | |
cd \Razord-meta-gh-pages | |
tar -zcvf meta_db.tar.gz * > /dev/null | |
mv -f meta_db.tar.gz ../ | |
cd .. | |
cd \Yacd-meta-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 \metacubexd-gh-pages | |
rm -rf \Razord-meta-gh-pages | |
rm -rf \Yacd-meta-gh-pages | |
echo 面板更新完成! | |
- name: Update GeoIP | |
run: | | |
cd && mkdir bin & cd bin | |
source version | |
curl -kfSL -O https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/Country.mmdb | |
curl -kfSL -o cn_mini.mmdb https://raw.githubusercontent.com/Hackl0us/GeoIP2-CN/release/Country.mmdb | |
curl -kfSL -o china_ip_list.txt https://raw.githubusercontent.com/17mon/china_ip_list/master/china_ip_list.txt | |
curl -kfSL -o china_ipv6_list.txt https://raw.githubusercontent.com/ChanthMiao/China-IPv6-List/release/cn6.txt | |
curl -kfSL -O https://raw.githubusercontent.com/P3TERX/ca-certificates.crt/download/ca-certificates.crt | |
curl -kfSL -O https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/geosite.dat | |
sed -i '/GeoIP_v*/'d version | |
echo GeoIP_v=`date '+%Y%m%d'` >> version | |
echo IP数据库及根证书文件更新完成! | |
- name: Merge to config | |
run: | | |
cp ./bin/Country.mmdb ./config & cp ./bin/geosite.dat ./config/GeoSite.dat | |
- name: Commit and push | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[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 |