-
Notifications
You must be signed in to change notification settings - Fork 30
241 lines (206 loc) · 8.38 KB
/
release.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
name: Generate v2ray routing rules
on:
workflow_dispatch:
inputs:
PRE_RELEASE:
description: "Set as pre-release"
required: false
type: boolean
default: false
schedule:
- cron: "40 4 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Iran-v2ray-rules repository
uses: actions/checkout@v4
- name: Checkout geolite2 branch
uses: actions/checkout@v4
with:
ref: geolite2
path: geolite2
- name: Checkout ip2location branch
uses: actions/checkout@v4
with:
ref: ip2location
path: ip2location
- name: Checkout redundant branch
uses: actions/checkout@v4
with:
ref: redundant
path: redundant
- name: Checkout ito.gov.ir-Mirror repository
uses: actions/checkout@v4
with:
repository: Chocolate4U/ito.gov.ir-Mirror
path: ito.gov.ir-Mirror
- name: Checkout domain-list-community repository
uses: actions/checkout@v4
with:
repository: v2fly/domain-list-community
path: v2ray-geosite
- name: Checkout ipranges repository
uses: actions/checkout@v4
with:
repository: lord-alfred/ipranges
path: ipranges
- name: Download geo-tools
run: gh release download -p "*.tar.gz" --repo Chocolate4U/geo-tools
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set ENV variables
run: |
echo "RELEASE_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "TAG_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
echo "RELEASE_DATE=$(date +'%A %F %T %Z')" >> $GITHUB_ENV
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install dos2unix idn2
- name: Create release directory
run: mkdir release
- name: Get messengers IP list
run: awk -F"," '{print $2}' ./ito.gov.ir-Mirror/data/Messengers.csv | sed '1d' > messengers-ip.txt
- name: Get domestic CDNs IP list
run: |
chmod +x ./scripts/generate-domestic-cdn-ips.sh
./scripts/generate-domestic-cdn-ips.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate ir domains list
run: |
chmod +x ./scripts/generate-ir-domains.sh
./scripts/generate-ir-domains.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate ad domains list
run: |
chmod +x ./scripts/generate-ad-domains.sh
./scripts/generate-ad-domains.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate malware list
run: |
chmod +x ./scripts/generate-malware-domains-ips.sh
./scripts/generate-malware-domains-ips.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate phishing list
run: |
chmod +x ./scripts/generate-phishing-domains-ips.sh
./scripts/generate-phishing-domains-ips.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate cryptominers domains list
run: |
chmod +x ./scripts/generate-cryptominer-domains.sh
./scripts/generate-cryptominer-domains.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate Social Media domains list
run: |
chmod +x ./scripts/generate-social-media-domains.sh
./scripts/generate-social-media-domains.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate nsfw domains list
run: |
chmod +x ./scripts/generate-nsfw-domains.sh
./scripts/generate-nsfw-domains.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate geoip files
run: |
tar -xvzf geoip.tar.gz
rm -rf ip2location/.git
./geoip convert -c config.json
cp output/dat/geoip.dat output/dat/geoip-lite.dat output/dat/security-ip.dat output/dat/geoip-services.dat release
cp output/maxmind/Country.mmdb output/maxmind/Country-lite.mmdb output/maxmind/Security-ip.mmdb output/maxmind/Services.mmdb release
cp -fpPR output/text release
- name: Verify *.mmdb files
run: |
tar -xvzf mmdbverify.tar.gz
./mmdbverify -file release/Country.mmdb
./mmdbverify -file release/Country-lite.mmdb
./mmdbverify -file release/Security-ip.mmdb
./mmdbverify -file release/Services.mmdb
- name: Generate geosite.dat, geosite-lite.dat and security.dat files
run: |
tar -xvzf geosite.tar.gz
cp ./release/ir.txt ./v2ray-geosite/data/ir
cp ./release/ads.txt ./v2ray-geosite/data/ads
cp ./release/category-ads-all.txt ./v2ray-geosite/data/category-ads-all
cp ./release/malware.txt ./v2ray-geosite/data/malware
cp ./release/phishing.txt ./v2ray-geosite/data/phishing
cp ./release/cryptominers.txt ./v2ray-geosite/data/cryptominers
cp ./release/social.txt ./v2ray-geosite/data/social
cp ./release/nsfw.txt ./v2ray-geosite/data/nsfw
./geosite --datapath=./v2ray-geosite/data --outputdir=./release --outputname=geosite.dat
mkdir datalite
cp ./release/ir-lite.txt datalite/ir
cp ./release/ads.txt datalite/ads
./geosite --datapath=datalite --outputdir=./release --outputname=geosite-lite.dat
mkdir security
cp ./release/category-ads-all.txt security/category-ads-all
cp ./release/malware.txt security/malware
cp ./release/phishing.txt security/phishing
cp ./release/cryptominers.txt security/cryptominers
./geosite --datapath=security --outputdir=./release --outputname=security.dat
- name: Generate sha256sum
run: |
sha256sum release/geoip.dat > release/geoip.dat.sha256sum
sha256sum release/geoip-lite.dat > release/geoip-lite.dat.sha256sum
sha256sum release/security-ip.dat > release/security-ip.dat.sha256sum
sha256sum release/geoip-services.dat > release/geoip-services.dat.sha256sum
sha256sum release/Country.mmdb > release/Country.mmdb.sha256sum
sha256sum release/Country-lite.mmdb > release/Country-lite.mmdb.sha256sum
sha256sum release/Security-ip.mmdb > release/Security-ip.mmdb.sha256sum
sha256sum release/Services.mmdb > release/Services.mmdb.sha256sum
sha256sum release/geosite.dat > release/geosite.dat.sha256sum
sha256sum release/geosite-lite.dat > release/geosite-lite.dat.sha256sum
sha256sum release/security.dat > release/security.dat.sha256sum
- name: Generate Release Notes
run: |
echo "* Updated on ${{ env.RELEASE_DATE }}" > RELEASE_NOTES
- name: Push assets to release branch
if: ${{ !inputs.PRE_RELEASE }}
run: |
cd release || 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 origin release
- name: Purge jsDelivr CDN cache
if: ${{ !inputs.PRE_RELEASE }}
run: |
cd release || exit 1
for file in $(ls); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@release/${file}"
done
- name: Release and upload assets
uses: softprops/action-gh-release@v2
with:
name: ${{ env.RELEASE_NAME }}
tag_name: ${{ env.TAG_NAME }}
body_path: RELEASE_NOTES
draft: false
prerelease: ${{ inputs.PRE_RELEASE }}
files: |
release/*.dat
release/*.mmdb
release/*.sha256sum
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clean older releases
if: ${{ !inputs.PRE_RELEASE }}
uses: dev-drprasad/[email protected]
with:
keep_latest: 7
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}