Update Rules #101
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
# Description: Update ADSS Rules using GitHub Actions | |
# | |
# This is free software, licensed under the GPL v3 License. | |
# See /LICENSE for more information. | |
name: Update Rules | |
env: | |
TZ: Asia/Shanghai | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 16 * * * | |
jobs: | |
Update: | |
name: Update Rules | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
contents: write | |
steps: | |
- name: CheckOut | |
uses: actions/checkout@v4 | |
- name: Set TimeZone | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo timedatectl set-timezone "$TZ" | |
- name: Build Rules | |
shell: sh | |
run: | | |
cd ${GITHUB_WORKSPACE} | |
sh ./installer/copyright.sh | |
sh ./rules/builder/initRulesFile.sh | |
echo | |
sh ./rules/builder/getDnsmasqAdRules.sh | |
echo | |
sh ./rules/builder/getHostsAdRules.sh | |
echo | |
sh ./rules/builder/deletWhiteListRules.sh | |
echo | |
echo -e "\e[1;36m 删除dnsmasq及hosts重复规则\e[0m" | |
echo | |
awk '!a[$0]++{print}' /tmp/adss/dnsAd >> /tmp/adss/dnsrules.conf | |
awk '!a[$0]++{print}' /tmp/adss/hostsAd >> /tmp/adss/hostsrules.conf | |
echo "# Modified DNS end" >> /tmp/adss/dnsrules.conf | |
echo "# 修饰hosts结束" >> /tmp/adss/hostsrules.conf | |
mv -f /tmp/adss/dnsrules.conf ./rules/file/dnsrules.conf | |
mv -f /tmp/adss/hostsrules.conf ./rules/file/hostsrules.conf | |
echo -e "\e[1;36m 规则创建完成!\e[0m" | |
- name: Git Auto Update Rules | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_author: Clion <clion007@126.com> | |
file_pattern: rules/file/*.conf | |
- name: Delete Workflow Runs | |
uses: Mattraks/delete-workflow-runs@main | |
continue-on-error: true | |
with: | |
retain_days: 0 | |
keep_minimum_runs: 5 |