-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (106 loc) · 4.13 KB
/
generate-geoip-geosite.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
name: Generate and Update AdAway/Torrents Lists
on:
push:
branches: [ main ]
schedule:
- cron: '0 1 * * *' # Weekly on Sundays (UTC)
permissions:
contents: write
jobs:
generate_lists:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Pull Changes
run: git pull
- name: Set up Node.js (if required)
uses: actions/setup-node@v4
with:
node-version: '20' # Adjust if needed
- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y curl wget git
- name: Download generate-geoip-geosite
run: |
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/Dunamis4tw/generate-geoip-geosite/releases/latest | grep "generate-geoip-geosite.*linux-amd64.tar.gz" | grep "browser_download_url" | cut -d '"' -f 4)
wget "$DOWNLOAD_URL" || exit 1 # Exit if download fails
- name: Extract generate-geoip-geosite
run: |
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/Dunamis4tw/generate-geoip-geosite/releases/latest | grep "generate-geoip-geosite.*linux-amd64.tar.gz" | grep "browser_download_url" | cut -d '"' -f 4)
ARCHIVE_NAME=${DOWNLOAD_URL##*/}
wget "$DOWNLOAD_URL"
tar -xf "$ARCHIVE_NAME"
rm "$ARCHIVE_NAME"
- name: Create adaway_alive_hosts_mail_fb.json
run: |
cat << EOF > adaway_alive_hosts_mail_fb.json
[
{
"url": "https://schakal.ru/hosts/alive_hosts_mail_fb.txt",
"contentType": "HostsFile",
"category": "adaway_alive_hosts_mail_fb"
}
]
EOF
- name: Create torrents.json
run: |
cat << EOF > torrents.json
[
{
"url": "https://raw.githubusercontent.com/im-sm/Pi-hole-Torrent-Blocklist/main/all-torrent-trackres.txt",
"contentType": "DefaultList",
"category": "torrent_trackres"
},
{
"url": "https://raw.githubusercontent.com/im-sm/Pi-hole-Torrent-Blocklist/main/all-torrent-websites.txt",
"contentType": "DefaultList",
"category": "torrent_websites"
}
]
EOF
- name: Create Antifilter.Download community edition.json
run: |
cat << EOF > аntifilter.json
[
{
"url": "https://community.antifilter.download/list/domains.lst",
"contentType": "DefaultList",
"category": "аntifilter_community_edition"
}
]
EOF
- name: Make generate-geoip-geosite executable
run: chmod +x generate-geoip-geosite
- name: Generate AdAway Lists
run: |
./generate-geoip-geosite -s adaway_alive_hosts_mail_fb.json -i adaway -o adaway --gen-rule-set-srs
- name: Generate Torrents Lists
run: |
./generate-geoip-geosite -s torrents.json -i torrents -o torrents --gen-rule-set-srs
- name: Generate аntifilter_community_edition Lists
run: |
./generate-geoip-geosite -s аntifilter.json -i аntifilter -o аntifilter --gen-rule-set-srs
- name: Copy .srs files to repository directory
run: |
cp ./adaway/*.srs /home/runner/work/RuRulesets/RuRulesets
cp ./torrents/*.srs /home/runner/work/RuRulesets/RuRulesets
cp ./аntifilter/*.srs /home/runner/work/RuRulesets/RuRulesets
- name: Get current date
id: date
run: |
echo "DATE=$(TZ=Europe/Moscow date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
- name: Commit and Push Changes
uses: EndBug/add-and-commit@v9
with:
add: '*.srs'
author_name: GitHub Action
author_email: [email protected]
message: 'Update AdAway and Torrents Lists ${{ env.DATE }}'
push: true
cwd: .
default_author: github_actor
fetch: --tags --force
pathspec_error_handling: ignore
github_token: ${{ secrets.RULESET_TOKEN }}