Skip to content

build-net

build-net #619

Workflow file for this run

name: build-net
on:
push:
branches:
- 'master'
paths:
- '.github/workflows/build-net.yml'
workflow_dispatch:
schedule:
- cron: '0 16 * * *'
jobs:
build-net:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Checkout reference branch 1
uses: actions/checkout@v4
with:
repository: gaoyifan/china-operator-ip
ref: ip-lists
path: ref1
- name: Checkout reference branch 2
uses: actions/checkout@v4
with:
repository: loyalsoldier/v2ray-rules-dat
ref: release
path: ref2
- name: Checkout reference branch 3
uses: actions/checkout@v4
with:
repository: vfarid/cf-ip-scanner
ref: main
path: ref3
- name: Checkout reference branch 4
uses: actions/checkout@v4
with:
repository: XIU2/CloudflareSpeedTest
ref: master
path: ref4
- name: Checkout target branch
uses: actions/checkout@v4
with:
ref: net
path: target
- name: Clean target branch
continue-on-error: true
run: rm target/*
- name: Rebuild target branch
run: |
./raydata.py ref2/geoip.dat -c CN -o target/chinaip.txt geoip
./netgen.py target/chinaip.txt -4 -o target/china4.txt
./netgen.py target/chinaip.txt -6 -o target/china6.txt
./netgen.py ref1/chinanet.txt -o target/telecom4.txt
./netgen.py ref1/chinanet6.txt -o target/telecom6.txt
./netgen.py ref1/unicom.txt -o target/unicom4.txt
./netgen.py ref1/unicom6.txt -o target/unicom6.txt
./netgen.py ref1/cmcc.txt -o target/mobile4.txt
./netgen.py ref1/cmcc6.txt -o target/mobile6.txt
./netgen.py target/china4.txt -e ref1/chinanet.txt ref1/unicom.txt -o target/chinae2v4.txt
./netgen.py target/china6.txt -e ref1/chinanet6.txt ref1/unicom6.txt -o target/chinae2v6.txt
./netgen.py target/china4.txt -e ref1/chinanet.txt ref1/unicom.txt ref1/cmcc.txt -o target/chinae3v4.txt
./netgen.py target/china6.txt -e ref1/chinanet6.txt ref1/unicom6.txt ref1/cmcc6.txt -o target/chinae3v6.txt
./netgen.py 0.0.0.0/0 -e private4.txt target/china4.txt -o target/foreign4.txt
./netgen.py ::/0 -e private6.txt target/china6.txt -o target/foreign6.txt
./netgen.py ref3/ipv4.txt -o target/cf4.txt
./netgen.py ref4/ipv6.txt -o target/cf6.txt
./netgen.py private4.txt -o target/private4.txt
./netgen.py private6.txt -o target/private6.txt
cd target
tree -H . -P "*.txt" -T "IP List - $(date +%Y-%m-%d)" > index.html
- name: Push to target branch
continue-on-error: true
run: |
cd target
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git commit -m "update $(date +%Y-%m-%d)"
git push -q