Skip to content

build-mosdns

build-mosdns #184

Workflow file for this run

name: build-mosdns
on:
push:
branches:
- 'master'
paths:
- '.github/workflows/build-mosdns.yml'
schedule:
- cron: '0 16 * * *'
jobs:
build-mosdns:
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: loyalsoldier/v2ray-rules-dat
ref: release
path: ref
- name: Checkout target branch
uses: actions/checkout@v3
with:
ref: mosdns
path: target
- name: Clean target branch
continue-on-error: true
run: rm target/*
- name: Rebuild target branch
run: |
cp mosdns/config.yml target/config.yml
./raydata.py ref/geoip.dat -c CN -o target/rule/chinaip.txt geoip
./raydata.py ref/geosite.dat -c CN -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
./raydata.py ref/geosite.dat -c ALIBABA -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
./raydata.py ref/geosite.dat -c ALIBABACLOUD -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
./raydata.py ref/geosite.dat -c ALIYUN -o target/rule/chinasite.txt geosite --formatter mosdns/format.json
mkdir target/tmp
cd target
tar -cf mosdns.tar tmp rule *.yml
rm tmp rule *.yml -r
- 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