name: build mosdns on: push: branches: ['*'] 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: 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 if: github.event_name == 'schedule' continue-on-error: true run: rm mosdns/* - name: Rebuild mosdns branch if: github.event_name == 'schedule' run: ./exp_mosdns.sh - name: Push to mosdns branch if: github.event_name == 'schedule' continue-on-error: true run: | cd mosdns tree -H . -P "*.txt" -T "MosDNS List - $(date +%Y-%m-%d)" > index.html 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