Skip to content

Nodes

Nodes #35867

Workflow file for this run

name: Nodes
on:
schedule: #UTC+0 #UTC+8
- cron: '*/35 0-8 * * 1-5' #工作日 上午8:00 - 下午4:00
- cron: '*/25 8-12 * * 1-5' #工作日 下午4:00 - 晚上8:00
- cron: '*/55 12-21 * * 1-4' #工作日 晚上8:00 - 次日凌晨5:00
- cron: '*/25 21-23 * * 1-5' #工作日 次日凌晨5:00 - 次日上午8:00
- cron: '*/25 14-21 * * 5' #星期五 晚上10:00 - 次日凌晨5:00
- cron: '*/25 * * * 0,6' #休息日 全天候
# repository_dispatch: #https://www.chenshaowen.com/blog/how-to-trigger-github-action-remotely.html
# types:
# - Webhook
workflow_dispatch: #手动调试按钮
jobs:
my-job:
name: Max Job
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 #git clone
- uses: actions/setup-node@v3 #Node.js环境
with:
node-version: '16.x' #Node.js 16.x
- uses: actions/setup-python@v4 #python环境
with:
python-version: '3.x' #python 3.x
cache: 'pip' #pip cache
- name: Timezone #UTC+0 → UTC+8
run: sudo timedatectl set-timezone 'Asia/Shanghai'
- name: git
run: | #配置git的上传用户名和邮箱
git config --local user.name "GitHub Actions"
git config --local user.email "[email protected]"
- name: npm
run: | #安装npm包
cd ./utils/rm/ && npm ci
- name: pip
run: | #安装pip包
pip install -r ./utils/pool/requirements.txt
pip install -r ./utils/clashcheck/requirements.txt
- name: pool #input ./utils/pool/config.yaml
run: cd ./utils/pool/ && python main.py #output ./utils/pool/output.yaml
# - name: copy pool to clashcheck #input ./utils/pool/output.yaml
# run: cp ./utils/pool/output.yaml ./utils/clashcheck/data/input.yaml #output ./utils/clashcheck/data/input.yaml
# - name: clashcheck #because ./utils/clashcheck/config/config.yaml so input ./utils/clashcheck/data/input.yaml
# run: cd ./utils/clashcheck/ && python main.py; rm data/input.yaml #output ./utils/clashcheck/data/check.yaml & delete ./utils/clashcheck/data/input.yaml
- name: pull clashcheck file #如果您想要fork本仓库并运行此workflow,请用#号注释掉这一行和下两行并删除上方四行开头的#并按照yaml文件格式对其行头
id: clashcheck
run: timeout -k 20 4m wget ${{ secrets.Check_File }} -O ./utils/clashcheck/data/check.yaml -q || timeout -k 20 4m wget ${{ secrets.Check_File }} -O ./utils/clashcheck/data/check.yaml -q
- name: when pull has failed
if: ${{ failure() && steps.clashcheck.conclusion == 'failure' }}
run: echo -e "\033[31mFailed to pull clashcheck file.\033[0m"; rm utils/clashcheck/data/check.yaml
- name: move clashcheck to clash2base64 #input ./utils/clashcheck/data/check.yaml
if: ${{ success() }}
run: mv ./utils/clashcheck/data/check.yaml ./utils/subconverter/check.yaml #output ./utils/subconverter/check.yaml
- name: clash2base64 #input ./utils/subconverter/check.yaml
if: ${{ success() }}
run: ./utils/subconverter/subconverter -g --artifact "clash2base64"; rm utils/subconverter/check.yaml #output ./utils/subconverter/check & delete ./utils/subconverter/check.yaml
- name: marge urls #because ./utils/subconverter/generate.ini so input ./utils/subconverter/check|input ./sub/url2
if: ${{ success() }}
run: base64 -d ./utils/subconverter/check > ./utils/rm/url1 && cat ./utils/rm/url1 ./sub/url2 > ./utils/rm/url; rm ./utils/subconverter/check ./utils/rm/url1 #output ./utils/rm/url & delete ./utils/subconverter/check ./utils/rm/url1 ./nodes
- name: remove & rename #input ./utils/rm/url
if: ${{ success() }}
run: cd ./utils/rm/ && npm start #output ./utils/rm/out
- name: url & https
if: ${{ success() }}
run: | #input ./utils/rm/out
rm ./utils/rm/url #delete ./utils/rm/url
mv ./utils/rm/out ./url #output ./url
./.github/url.sh > ./1 #output ./1
cp url 2 #output ./2
cat 1 2 > 3; rm 1 2 #output ./3 & delete ./1 ./2
base64 3 > https -w 0; rm 3 #output ./https & delete ./3
base64 ./url > ./utils/subconverter/base64 -w 0 #url文件base64编码引入subconverter
cp ./utils/pool/output.yaml ./utils/subconverter/output.yaml #output.yaml节点池引入subconverter
sort url -o url #将url排序并修改至原文件,突出增删的节点 output ./url
- name: long & Clash.yaml
if: ${{ success() }}
run: | #input ./utils/subconverter/base64 ./utils/subconverter/output.yaml
./utils/subconverter/subconverter -g --artifact "clash"
./utils/subconverter/subconverter -g --artifact "long"
./utils/subconverter/subconverter -g --artifact "output"
#output ./utils/subconverter/Clash.yaml ./utils/subconverter/long ./utils/subconverter/output.txt
mv ./utils/subconverter/Clash.yaml ./Clash.yaml || true #output ./Clash.yaml
mv ./utils/subconverter/long ./long || true #output ./long
mv ./utils/subconverter/output.txt ./utils/pool/output.txt || true #output ./utils/pool/output.txt
rm ./utils/subconverter/base64 ./utils/subconverter/output.yaml #delete ./utils/subconverter/base64 ./utils/subconverter/output.yaml
- name: git push
if: ${{ always() }}
run: ./.github/update-repo.sh #upload files ./url ./https ./long ./Clash.yaml ./utils/pool/output.yaml ./utils/pool/output.txt to GitHub
# Webhook: #触发Webhook启动下一次自动化
# needs: my-job
# runs-on: ubuntu-latest
# steps:
# - name: cURL
# run: curl -s https://raw.githubusercontent.com/yu-steven/openit/main/.github/webhook.sh | bash -s ${{ secrets.webhook }}