-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (138 loc) · 6.61 KB
/
run.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Generate routing rules for smartdns
on:
workflow_dispatch:
schedule:
- cron: "30 22 * * *"
push:
branches:
- master
paths-ignore:
- "**/README.md"
permissions:
contents: write
packages: write
actions: write
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set variables
run: |
echo "RELEASE_NAME=Released on $(date +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "TAG_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "heidai_dns=https://raw.githubusercontent.com/217heidai/adblockfilters/main/rules/adblockdns.txt" >> $GITHUB_ENV
echo "AdGuardSDNSFilter=https://adguardteam.github.io/AdGuardSDNSFilter/Filters/filter.txt" >> $GITHUB_ENV
echo "BlueSkyXN_skyrules=https://raw.githubusercontent.com/BlueSkyXN/AdGuardHomeRules/master/skyrules.txt" >> $GITHUB_ENV
echo "BlueSkyXN_ok=https://raw.githubusercontent.com/BlueSkyXN/AdGuardHomeRules/master/ok.txt" >> $GITHUB_ENV
echo "Cats_Team_adrules=https://raw.githubusercontent.com/Cats-Team/AdRules/main/adrules.list" >> $GITHUB_ENV
echo "neodevpro_host=https://raw.githubusercontent.com/neodevpro/neodevhost/master/domain" >> $GITHUB_ENV
echo "1Hosts_mini=https://raw.githubusercontent.com/badmojr/1Hosts/master/mini/domains.txt" >> $GITHUB_ENV
echo "1Hosts_Lite=https://raw.githubusercontent.com/badmojr/1Hosts/master/Lite/domains.txt" >> $GITHUB_ENV
echo "1Hosts_Pro=https://raw.githubusercontent.com/badmojr/1Hosts/master/Pro/domains.txt" >> $GITHUB_ENV
echo "AWAvenue_Ads_Rule=https://raw.githubusercontent.com/TG-Twilight/AWAvenue-Ads-Rule/main/Filters/AWAvenue-Ads-Rule-AdClose.txt" >> $GITHUB_ENV
echo "hBlock_hosts=https://hblock.molinero.dev/hosts_domains.txt" >> $GITHUB_ENV
echo "OISD_small=https://small.oisd.nl/domainswild2" >> $GITHUB_ENV
echo "OISD_big=https://big.oisd.nl/domainswild2" >> $GITHUB_ENV
echo "OISD_nsfw=https://nsfw.oisd.nl/domainswild2" >> $GITHUB_ENV
echo "PiHoleBlocklist=https://raw.githubusercontent.com/Perflyst/PiHoleBlocklist/master/SmartTV.txt" >> $GITHUB_ENV
echo "1024_hosts=https://raw.githubusercontent.com/Goooler/1024_hosts/master/hosts" >> $GITHUB_ENV
echo "ad_wars=https://raw.githubusercontent.com/jdlingyu/ad-wars/master/hosts" >> $GITHUB_ENV
echo "StevenBlack_hosts=https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" >> $GITHUB_ENV
shell: bash
- name: Checkout the default branch
uses: actions/checkout@v4
- name: Make directory
run: |
mkdir -p 217heidai
mkdir -p AdGuard
mkdir -p BlueSkyXN
mkdir -p Cats-Team
mkdir -p neodevhost
- name: Generate 217heidai file
run: |
curl -sSL ${heidai_dns} | grep "^||" | sed -e 's/^||//; s/\^$//' > 217heidai/adblockdns.txt
curl -sSL ${heidai_dns} | grep "^@@||" | sed -e 's/^@@||//; s/[\|]$//; s/[\^]$//' > 217heidai/adblockdns-whitelist.txt
- name: Generate AdGuard file
run: |
curl -sSL ${AdGuardSDNSFilter} | grep "^||" | sed -e 's/^||//; s/\^$//' > AdGuard/dnsfilter.txt
curl -sSL ${AdGuardSDNSFilter} | grep "^@@||" | sed -e 's/^@@||//; s/[\|]$//; s/[\^]$//' > AdGuard/dnsfilter-whitelist.txt
- name: Generate BlueSkyXN file
run: |
curl -sSL ${BlueSkyXN_skyrules} | grep "^||" | sed -e 's/^||//; s/\^.*//' > BlueSkyXN/skyrules.txt
curl -sSL ${BlueSkyXN_ok} | grep "^@@||" | sed -e 's/^@@||//; s/[\|]$//; s/[\^]$//' > BlueSkyXN/ok.txt
- name: Generate Cats-Team file
run: |
curl -sSL ${Cats_Team_adrules} | grep "^DOMAIN-SUFFIX," | sed -e 's/^DOMAIN-SUFFIX,//' > Cats-Team/adrules.txt
- name: Generate neodevhost file
run: |
curl -sSL ${neodevpro_host} | grep -Ev "^#" > neodevhost/domain.txt
- name: Zip 217heidai
uses: montudor/action-zip@v1
with:
args: zip -qq -r 217heidai.zip 217heidai
- name: Zip AdGuard
uses: montudor/action-zip@v1
with:
args: zip -qq -r AdGuard.zip AdGuard
- name: Zip BlueSkyXN
uses: montudor/action-zip@v1
with:
args: zip -qq -r BlueSkyXN.zip BlueSkyXN
- name: Zip Cats-Team
uses: montudor/action-zip@v1
with:
args: zip -qq -r Cats-Team.zip Cats-Team
- name: Zip neodevhost
uses: montudor/action-zip@v1
with:
args: zip -qq -r neodevhost.zip neodevhost
- name: Upload files to GitHub release
uses: softprops/[email protected]
with:
tag_name: ${{ env.TAG_NAME }}
files: |
./*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Move files to publish directory
run: |
mkdir -p publish/217heidai
mkdir -p publish/AdGuard
mkdir -p publish/BlueSkyXN
mkdir -p publish/Cats-Team
mkdir -p publish/neodevhost
mv 217heidai/* ./publish/217heidai/
mv AdGuard/* ./publish/AdGuard/
mv BlueSkyXN/* ./publish/BlueSkyXN/
mv Cats-Team/* ./publish/Cats-Team/
mv neodevhost/* ./publish/neodevhost/
- name: Git push assets to "release" branch
run: |
cd publish || exit 1
git init
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b release
git add .
git commit -m "${{ env.RELEASE_NAME }}"
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
git push -f -u origin release
- name: Purge jsdelivr CDN
run: |
cd publish || exit 1
for file in $(ls 217heidai); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@release/217heidai/${file}"
done
for file in $(ls AdGuard); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@release/AdGuard/${file}"
done
for file in $(ls BlueSkyXN); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@release/BlueSkyXN/${file}"
done
for file in $(ls Cats-Team); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@release/Cats-Team/${file}"
done
for file in $(ls neodevhost); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@release/neodevhost/${file}"
done