name: build mosdns on: push: branches: - 'master' paths: - '.github/workflows/**' schedule: - cron: '10 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: Check out release branch of loyalsoldier/v2ray-rules-dat uses: actions/checkout@v3 with: repository: loyalsoldier/v2ray-rules-dat ref: release path: dat-release - name: Checkout mosdns branch uses: actions/checkout@v3 with: ref: mosdns path: mosdns - name: Clean mosdns branch continue-on-error: true run: rm mosdns/* - name: Rebuild mosdns branch run: | ./raydata.py dat-release/geoip.dat -c cn -o mosdns/chinaip.txt geoip ./raydata.py dat-release/geosite.dat -c cn -o mosdns/chinasite.txt geosite --formatter format_mosdns.json - name: Push to mosdns branch continue-on-error: true run: | cd mosdns tar -cf mosdns.tar *.txt rm *.txt 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