Files
netlist/.github/workflows/build-net.yml
T
2023-07-21 07:54:23 +08:00

72 lines
2.2 KiB
YAML

name: build-net
on:
push:
branches:
- 'master'
paths:
- '.github/workflows/build-net.yml'
schedule:
- cron: '0 16 * * *'
jobs:
build-net:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
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
uses: actions/checkout@v3
with:
repository: gaoyifan/china-operator-ip
ref: ip-lists
path: ref
- name: Checkout target branch
uses: actions/checkout@v3
with:
ref: net
path: target
- name: Clean target branch
continue-on-error: true
run: rm target/*
- name: Rebuild target branch
run: |
./netgen.py ref/china.txt -o target/china.txt
./netgen.py ref/china6.txt -o target/china6.txt
./netgen.py ref/chinanet.txt -o target/telecom.txt
./netgen.py ref/chinanet6.txt -o target/telecom6.txt
./netgen.py ref/unicom.txt -o target/unicom.txt
./netgen.py ref/unicom6.txt -o target/unicom6.txt
./netgen.py ref/china.txt -e ref/chinanet.txt ref/unicom.txt -o target/others.txt
./netgen.py ref/china6.txt -e ref/chinanet6.txt ref/unicom6.txt -o target/others6.txt
./netgen.py 0.0.0.0/0 -e private.txt ref/china.txt -o target/foreign.txt
./netgen.py ::/0 -e private6.txt ref/china6.txt -o target/foreign6.txt
./netgen.py private.txt -o target/private.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