Files
openit/.github/workflows/Nodes.yaml
2022-07-05 11:52:02 +08:00

117 lines
5.3 KiB
YAML

name: Nodes
on:
schedule: #これは UTC+0 #これは UTC+8
- cron: '*/34 0-8 * * 1-5' #工作日 上午8:00 - 下午4:00
- cron: '*/24 8-14 * * 1-5' #工作日 下午4:00 - 下午10:00
- cron: '*/54 14-21 * * 1-5' #工作日 下午10:00 - 次日凌晨5:00
- cron: '*/24 21-23 * * 1-5' #工作日 次日凌晨5:00 - 次日上午8:00
- cron: '*/24 * * * 0,6' #休息日 全天候
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 #node.js 16
- 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 pull.rebase false
git config --local user.name "GitHub Actions"
git config --local user.email "actions@github.com"
- 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/ && timeout -k 30s 18m python main.py || true #output ./utils/pool/output.yaml
- name: copy pool to subconverter #input ./utils/pool/output.yaml
run: cp ./utils/pool/output.yaml ./utils/subconverter/input.yaml #output ./utils/subconverter/input.yaml
- name: subconverter #input ./utils/subconverter/input.yaml
run: ./utils/subconverter/subconverter -g --artifact "filter" && rm ./utils/subconverter/input.yaml #delete ./utils/subconverter/input.yaml & output ./utils/subconverter/output.yaml
- name: fix output.yaml
run: cd ./utils/subconverter/ && sed -i '/ !<str>/d' output.yaml #fix
- name: move subconverter to clashcheck #input ./utils/subconverter/output.yaml
run: mv ./utils/subconverter/output.yaml ./utils/clashcheck/input.yaml #output ./utils/clashcheck/input.yaml
- name: clashcheck #because ./utils/clashcheck/config.yaml so input ./utils/clashcheck/input.yaml
run: cd ./utils/clashcheck/ && python main.py && python main.py && python main.py #output ./utils/clashcheck/check.yaml
- name: copy clashcheck to subconverter #input ./utils/clashcheck/check.yaml
run: cp ./utils/clashcheck/check.yaml ./utils/subconverter/rm0 #output ./utils/subconverter/rm0
- name: subconverter #input ./utils/subconverter/rm0
run: ./utils/subconverter/subconverter -g --artifact "rm" && rm ./utils/subconverter/rm0 #delete ./utils/subconverter/rm0 & output ./utils/subconverter/rm1
- name: move subconverter to Remove & Remark #input ./utils/subconverter/rm1
run: mv ./utils/subconverter/rm1 ./utils/rm/rm1 #output ./utils/rm/rm1
- name: Remove & Remark
run: | #input ./utils/rm/rm1
cd ./utils/rm/
#input ./utils/rm/rm1
base64 -d rm1 > rm2 #output ./utils/rm/rm2
#input ./utils/rm/rm2
npm start #output ./utils/rm/out
- name: url & https
run: | #input ./utils/rm/out
rm ./utils/rm/rm1 ./utils/rm/rm2 #delete ./utils/rm/rm1 & ./utils/rm/rm2
#input ./utils/rm/out
mv ./utils/rm/out ./url #output ./url
#input ./url
base64 ./url > ./utils/subconverter/check -w 0 #output ./utils/subconverter/check
#input ./.github/url.sh
./.github/url.sh > ./1 #output ./1
#input ./url
cp ./url ./2 #output ./2
#input ./1 ./2
cat 1 2 > 3 && rm 1 2 #delete ./1 ./2 & output ./3
#input ./3
base64 3 > https -w 0 && rm 3 #delete ./3 & output ./https
- name: long & Clash.yaml
run: | #input ./utils/subconverter/check
./utils/subconverter/subconverter -g
#output ./utils/subconverter/long ./utils/subconverter/Clash.yaml ./utils/subconverter/pool.yaml ./utils/subconverter/rm1
mv ./utils/subconverter/long ./long || true
mv ./utils/subconverter/Clash.yaml ./Clash.yaml || true
rm ./utils/subconverter/check ./utils/subconverter/pool.yaml ./utils/subconverter/rm1 #delete ../check ../pool.yaml ../rm1
- name: git push
run: ./.github/update-repo.sh || true #upload files ./url ./https ./long ./Clash.yaml ./utils/pool/output.yaml ./utils/clashcheck/input.yaml ./utils/clashcheck/check.yaml to GitHub
long: #jsdelivr long同步
needs: my-job
runs-on: ubuntu-latest
steps:
- name: CDN
run: curl https://purge.jsdelivr.net/gh/yu-steven/openit@main/long
HTTPS: #jsdelivr HTTPS同步
needs: my-job
runs-on: ubuntu-latest
steps:
- name: CDN
run: curl https://purge.jsdelivr.net/gh/yu-steven/openit@main/https
Clash: #jsdelivr Clash同步
needs: my-job
runs-on: ubuntu-latest
steps:
- name: CDN
run: curl https://purge.jsdelivr.net/gh/yu-steven/openit@main/Clash.yaml
Quanx: #jsdelivr Quanx同步
needs: my-job
runs-on: ubuntu-latest
steps:
- name: CDN
run: curl https://purge.jsdelivr.net/gh/yu-steven/openit@main/Quanx.conf