-
Notifications
You must be signed in to change notification settings - Fork 47
70 lines (59 loc) · 1.91 KB
/
update_rules.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# 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