name: build-ros-list on: push: branches: - "master" paths: - ".github/workflows/build-ros-list.yml" workflow_dispatch: schedule: - cron: "10 16 * * *" jobs: build-ros-list: 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 pyproject.toml ]; then pip install .[network]; fi - name: Checkout reference branch 1 uses: actions/checkout@v4 with: ref: net path: ref1 - name: Checkout target branch uses: actions/checkout@v4 with: ref: ros-list path: target - name: Clean target branch continue-on-error: true run: rm target/* - name: Rebuild target branch run: | echo -e '/ip firewall address-list\nremove [find list=List_China]\n' > target/china4.rsc echo -e '/ipv6 firewall address-list\nremove [find list=List_China]\n' > target/china6.rsc ./netgen.py ref1/china4.txt -o target/china4.rsc -p 'add address=' -s ' list=List_China' ./netgen.py ref1/china6.txt -o target/china6.rsc -p 'add address=' -s ' list=List_China' echo -e '/ip firewall address-list\nremove [find list=List_Telecom]\n' > target/telecom4.rsc echo -e '/ipv6 firewall address-list\nremove [find list=List_Telecom]\n' > target/telecom6.rsc ./netgen.py ref1/telecom4.txt -o target/telecom4.rsc -p 'add address=' -s ' list=List_Telecom' ./netgen.py ref1/telecom6.txt -o target/telecom6.rsc -p 'add address=' -s ' list=List_Telecom' echo -e '/ip firewall address-list\nremove [find list=List_Unicom]\n' > target/unicom4.rsc echo -e '/ipv6 firewall address-list\nremove [find list=List_Unicom]\n' > target/unicom6.rsc ./netgen.py ref1/unicom4.txt -o target/unicom4.rsc -p 'add address=' -s ' list=List_Unicom' ./netgen.py ref1/unicom6.txt -o target/unicom6.rsc -p 'add address=' -s ' list=List_Unicom' echo -e '/ip firewall address-list\nremove [find list=List_Mobile]\n' > target/mobile4.rsc echo -e '/ipv6 firewall address-list\nremove [find list=List_Mobile]\n' > target/mobile6.rsc ./netgen.py ref1/mobile4.txt -o target/mobile4.rsc -p 'add address=' -s ' list=List_Mobile' ./netgen.py ref1/mobile6.txt -o target/mobile6.rsc -p 'add address=' -s ' list=List_Mobile' echo -e '/ip firewall address-list\nremove [find list=List_ChinaE2]\n' > target/chinae2v4.rsc echo -e '/ipv6 firewall address-list\nremove [find list=List_ChinaE2]\n' > target/chinae2v6.rsc ./netgen.py ref1/chinae2v4.txt -o target/chinae2v4.rsc -p 'add address=' -s ' list=List_ChinaE2' ./netgen.py ref1/chinae2v6.txt -o target/chinae2v6.rsc -p 'add address=' -s ' list=List_ChinaE2' echo -e '/ip firewall address-list\nremove [find list=List_ChinaE3]\n' > target/chinae3v4.rsc echo -e '/ipv6 firewall address-list\nremove [find list=List_ChinaE3]\n' > target/chinae3v6.rsc ./netgen.py ref1/chinae3v4.txt -o target/chinae3v4.rsc -p 'add address=' -s ' list=List_ChinaE3' ./netgen.py ref1/chinae3v6.txt -o target/chinae3v6.rsc -p 'add address=' -s ' list=List_ChinaE3' echo -e '/ip firewall address-list\nremove [find list=List_Foreign]\n' > target/foreign4.rsc echo -e '/ipv6 firewall address-list\nremove [find list=List_Foreign]\n' > target/foreign6.rsc ./netgen.py ref1/foreign4.txt -o target/foreign4.rsc -p 'add address=' -s ' list=List_Foreign' ./netgen.py ref1/foreign6.txt -o target/foreign6.rsc -p 'add address=' -s ' list=List_Foreign' echo -e '/ip firewall address-list\nremove [find list=List_CF]\n' > target/cf4.rsc echo -e '/ipv6 firewall address-list\nremove [find list=List_CF]\n' > target/cf6.rsc ./netgen.py ref1/cf4.txt -o target/cf4.rsc -p 'add address=' -s ' list=List_CF' ./netgen.py ref1/cf6.txt -o target/cf6.rsc -p 'add address=' -s ' list=List_CF' echo -e '/ip firewall address-list\nremove [find list=List_Private]\n' > target/private4.rsc echo -e '/ipv6 firewall address-list\nremove [find list=List_Private]\n' > target/private6.rsc ./netgen.py private4.txt -o target/private4.rsc -p 'add address=' -s ' list=List_Private' ./netgen.py private6.txt -o target/private6.rsc -p 'add address=' -s ' list=List_Private' cd target tree -H . -P "*.txt" -T "ROS 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