Generate Blacklist #446
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Blacklist | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 1 * * * | |
env: | |
TZ: Asia/Shanghai | |
SMARTDNS_URL: https://github.com/pymumu/smartdns/releases/download/Release45/smartdns-x86_64 | |
SMARTDNS_PATH: /tmp/smartdns | |
jobs: | |
Generate_Blacklist: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@main | |
- name: Setup Python 3.9.x | |
uses: actions/setup-python@main | |
with: | |
python-version: '3.9.x' | |
- name: Install Dependencies | |
run: | | |
sudo timedatectl set-timezone "$TZ" | |
python -m pip install --upgrade pip | |
pip install -U tld IPy dnspython httpx loguru | |
- name: Setup SmartDNS | |
run: | | |
mkdir -p $SMARTDNS_PATH | |
wget $SMARTDNS_URL -O $SMARTDNS_PATH/smartdns | |
chmod +x $SMARTDNS_PATH/smartdns | |
cp smartdns.conf $SMARTDNS_PATH/smartdns.conf | |
nohup $SMARTDNS_PATH/smartdns -f -x -c $SMARTDNS_PATH/smartdns.conf > /dev/null 2>&1 & | |
- name: Generate Blacklist | |
id: update | |
run: | | |
python blacklist.py | |
rm -rf __pycache__ | |
echo "message=$(date)" >> $GITHUB_OUTPUT | |
- name: Commit Changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: ${{ steps.update.outputs.message }} | |
- name: Delete workflow runs | |
uses: Mattraks/delete-workflow-runs@main | |
with: | |
retain_days: 1 | |
keep_minimum_runs: 5 |