mirror of
https://github.com/darkclip/netlist.git
synced 2026-11-13 17:03:55 +08:00
93 lines
4.6 KiB
YAML
93 lines
4.6 KiB
YAML
name: build-sha
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
paths:
|
|
- '.github/workflows/build-sha.yml'
|
|
schedule:
|
|
- cron: '0 16 * * *'
|
|
|
|
jobs:
|
|
build-sha:
|
|
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 1
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: gaoyifan/china-operator-ip
|
|
ref: ip-lists
|
|
path: ref1
|
|
- name: Checkout reference branch 2
|
|
uses: actions/checkout@v3
|
|
with:
|
|
repository: 17mon/china_ip_list
|
|
ref: master
|
|
path: ref2
|
|
- name: Checkout target branch
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: sha
|
|
path: target
|
|
- name: Clean target branch
|
|
continue-on-error: true
|
|
run: rm target/*
|
|
- name: Rebuild target branch
|
|
run: |
|
|
echo 'iptables -t nat -A POSTROUTING -o wgcf -j MASQUERADE || true' >> target/wgcf-up.sh
|
|
echo 'ip6tables -t nat -A POSTROUTING -o wgcf -j MASQUERADE || true' >> target/wgcf-up.sh
|
|
echo 'iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE || true' >> target/wgcf-up.sh
|
|
echo 'ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE || true' >> target/wgcf-up.sh
|
|
echo 'ip route add 188.114.96.0/22 dev eth0 via 10.11.0.1 || true' >> target/wgcf-up.sh
|
|
echo 'ip route add 2606:4700:d0::/47 dev eth0 via fe80::6a77:24ff:fed6:809d || true' >> target/wgcf-up.sh
|
|
echo 'ip route add 1.1.1.1/32 dev wgcf || true' >> target/wgcf-up.sh
|
|
echo 'ip route add 0.0.0.0/1 dev wgcf || true' >> target/wgcf-up.sh
|
|
echo 'ip route add 128.0.0.0/1 dev wgcf || true' >> target/wgcf-up.sh
|
|
echo 'ip route add ::/1 dev wgcf || true' >> target/wgcf-up.sh
|
|
echo 'ip route add 8000::/1 dev wgcf || true' >> target/wgcf-up.sh
|
|
./netgen.py ref2/china_ip_list.txt -o target/wgcf-up.sh -p 'ip route add ' -s $' dev eth0 via 10.11.0.1 || true\n'
|
|
./netgen.py ref1/china6.txt -o target/wgcf-up.sh -p 'ip route add ' -s $' dev eth0 via fe80::6a77:24ff:fed6:809d || true\n'
|
|
./netgen.py private4.txt -o target/wgcf-up.sh -p 'ip route add ' -s $' dev eth0 via 10.11.0.1 || true\n'
|
|
./netgen.py private6.txt -o target/wgcf-up.sh -p 'ip route add ' -s $' dev eth0 via fe80::6a77:24ff:fed6:809d || true\n'
|
|
echo 'iptables -t nat -D POSTROUTING -o wgcf -j MASQUERADE || true' >> target/wgcf-down.sh
|
|
echo 'ip6tables -t nat -D POSTROUTING -o wgcf -j MASQUERADE || true' >> target/wgcf-down.sh
|
|
echo 'iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE || true' >> target/wgcf-down.sh
|
|
echo 'ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE || true' >> target/wgcf-down.sh
|
|
echo 'ip route del 188.114.96.0/22 dev eth0 via 10.11.0.1 || true' >> target/wgcf-down.sh
|
|
echo 'ip route del 2606:4700:d0::/47 dev eth0 via fe80::6a77:24ff:fed6:809d || true' >> target/wgcf-down.sh
|
|
echo 'ip route del 1.1.1.1/32 dev wgcf || true' >> target/wgcf-down.sh
|
|
echo 'ip route del 0.0.0.0/1 dev wgcf || true' >> target/wgcf-down.sh
|
|
echo 'ip route del 128.0.0.0/1 dev wgcf || true' >> target/wgcf-down.sh
|
|
echo 'ip route del ::/1 dev wgcf || true' >> target/wgcf-down.sh
|
|
echo 'ip route del 8000::/1 dev wgcf || true' >> target/wgcf-down.sh
|
|
./netgen.py ref2/china_ip_list.txt -o target/wgcf-down.sh -p 'ip route del ' -s $' dev eth0 via 10.11.0.1 || true\n'
|
|
./netgen.py ref1/china6.txt -o target/wgcf-down.sh -p 'ip route del ' -s $' dev eth0 via fe80::6a77:24ff:fed6:809d || true\n'
|
|
./netgen.py private4.txt -o target/wgcf-up.sh -p 'ip route del ' -s $' dev eth0 via 10.11.0.1 || true\n'
|
|
./netgen.py private6.txt -o target/wgcf-up.sh -p 'ip route del ' -s $' dev eth0 via fe80::6a77:24ff:fed6:809d || true\n'
|
|
cp cf-watch.sh target/
|
|
cd target
|
|
chmod +x *.sh
|
|
tar -cf sha.tar *.sh
|
|
rm *.sh
|
|
- 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
|