2019-12-13 23:26:24 +08:00
|
|
|
name: Build v2ray rules dat files
|
2019-12-13 15:23:54 +08:00
|
|
|
on:
|
|
|
|
schedule:
|
2019-12-22 22:09:23 +08:00
|
|
|
- cron: "0 22 * * *"
|
2019-12-13 23:26:24 +08:00
|
|
|
push:
|
|
|
|
branches:
|
2019-12-15 18:14:44 +08:00
|
|
|
- master
|
2019-12-10 17:28:39 +08:00
|
|
|
|
2019-12-10 15:40:58 +08:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Build
|
2019-12-10 17:17:09 +08:00
|
|
|
runs-on: ubuntu-latest
|
2019-12-10 19:28:01 +08:00
|
|
|
|
2019-12-10 15:40:58 +08:00
|
|
|
steps:
|
2019-12-23 21:39:20 +08:00
|
|
|
- name: Setup Go 1.13
|
2019-12-10 15:40:58 +08:00
|
|
|
uses: actions/setup-go@v1
|
|
|
|
with:
|
|
|
|
go-version: 1.13
|
|
|
|
id: go
|
|
|
|
|
2019-12-23 20:42:11 +08:00
|
|
|
- name: Set $GOPATH and more variables
|
2019-12-13 23:26:24 +08:00
|
|
|
run: |
|
2019-12-23 20:42:11 +08:00
|
|
|
echo "::set-env name=NAME::Released on $(date +%Y%m%d%H%M)"
|
|
|
|
echo "::set-env name=TAG_NAME::$(date +%Y%m%d%H%M)"
|
2019-12-13 23:26:24 +08:00
|
|
|
echo "::set-env name=GEOIP_REPO::github.com/v2ray/geoip"
|
|
|
|
echo "::set-env name=GEOSITE_REPO::github.com/v2ray/domain-list-community"
|
2020-01-10 14:15:44 +08:00
|
|
|
echo "::set-env name=CHINA_DOMAINS_URL::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf"
|
2020-01-09 19:00:24 +08:00
|
|
|
echo "::set-env name=GOOGLE_DOMAINS_URL::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf"
|
|
|
|
echo "::set-env name=APPLE_DOMAINS_URL::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf"
|
|
|
|
echo "::set-env name=GFWLIST_DOMAINS_URL::https://cokebar.github.io/gfwlist2dnsmasq/gfwlist_domain.txt"
|
|
|
|
echo "::set-env name=GREATFIRE_DOMAINS_URL::https://raw.githubusercontent.com/wongsyrone/domain-block-list/master/domains.txt"
|
2020-01-10 16:10:06 +08:00
|
|
|
echo "::set-env name=PROFILES_URL::https://raw.githubusercontent.com/ConnersHua/Profiles/master/Shadow/Pro.conf"
|
2020-01-10 14:15:44 +08:00
|
|
|
echo "::set-env name=GEQ1AN_RULES_APPLE_URL::https://raw.githubusercontent.com/GeQ1an/Rules/master/QuantumultX/Filter/Apple.list"
|
|
|
|
echo "::set-env name=GEQ1AN_RULES_MICROSOFT_URL::https://raw.githubusercontent.com/GeQ1an/Rules/master/QuantumultX/Filter/Microsoft.list"
|
|
|
|
echo "::set-env name=GEQ1AN_RULES_GLOBAL_MEDIA_URL::https://raw.githubusercontent.com/GeQ1an/Rules/master/QuantumultX/Filter/GMedia.list"
|
|
|
|
echo "::set-env name=GEQ1AN_RULES_OUTSIDE_URL::https://raw.githubusercontent.com/GeQ1an/Rules/master/QuantumultX/Filter/Outside.list"
|
|
|
|
echo "::set-env name=GEQ1AN_RULES_REJECT_URL::https://raw.githubusercontent.com/GeQ1an/Rules/master/QuantumultX/Filter/AdBlock.list"
|
|
|
|
echo "::set-env name=LHIE1_RULES_REJECT_URL::https://raw.githubusercontent.com/lhie1/Rules/master/Auto/REJECT.conf"
|
2019-12-31 02:27:18 +08:00
|
|
|
echo "::set-env name=GOPATH::$(dirname $GITHUB_WORKSPACE)"
|
2019-12-13 23:26:24 +08:00
|
|
|
echo "::add-path::$(dirname $GITHUB_WORKSPACE)/bin"
|
|
|
|
shell: bash
|
2019-12-11 02:56:31 +08:00
|
|
|
|
2019-12-23 20:42:11 +08:00
|
|
|
- name: Checkout branch named hidden of this repo
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: hidden
|
|
|
|
|
2019-12-31 22:39:50 +08:00
|
|
|
- name: Get GeoLite2 file
|
|
|
|
run: |
|
2019-12-31 23:40:04 +08:00
|
|
|
curl -L -o GeoLite2-Country-CSV.zip "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=JvbzLLx7qBZT&suffix=zip"
|
2019-12-31 22:39:50 +08:00
|
|
|
unzip GeoLite2-Country-CSV.zip
|
|
|
|
rm -f GeoLite2-Country-CSV.zip
|
|
|
|
mv GeoLite2* geoip
|
2019-12-10 17:28:39 +08:00
|
|
|
|
2019-12-31 22:39:50 +08:00
|
|
|
- name: Generate geoip.dat file
|
2019-12-13 23:26:24 +08:00
|
|
|
run: |
|
2019-12-31 22:39:50 +08:00
|
|
|
go get -u -v -insecure $GEOIP_REPO
|
|
|
|
geoip --country=./geoip/GeoLite2-Country-Locations-en.csv --ipv4=./geoip/GeoLite2-Country-Blocks-IPv4.csv --ipv6=./geoip/GeoLite2-Country-Blocks-IPv6.csv
|
2019-12-13 23:26:24 +08:00
|
|
|
mkdir -p ./publish
|
|
|
|
mv ./geoip.dat ./publish/
|
|
|
|
|
|
|
|
- name: Download geosite project
|
|
|
|
run: |
|
2019-12-13 23:36:57 +08:00
|
|
|
go get -u -v -insecure $GEOSITE_REPO
|
2020-01-26 22:16:41 +08:00
|
|
|
|
|
|
|
- name: Automatically generate ookla-speedtest sub-list from source
|
|
|
|
run: |
|
|
|
|
curl -L -o servers-source.xml "https://c.speedtest.net/speedtest-servers-static.php"
|
|
|
|
cat servers-source.xml | sed -nEe 's/.+host="(.+):[0-9]+".+/\L\1/p' | sort -u > hosts-with-ip.txt
|
|
|
|
sed -E '/^([0-9]{1,3}\.){3}[0-9]{1,3}$/d' hosts-with-ip.txt > hosts-without-ip.txt
|
|
|
|
cat hosts-without-ip.txt | awk '{printf "full:%s\n", $0}' > $GOPATH/src/$GEOSITE_REPO/data/ookla-speedtest
|
|
|
|
echo "include:ookla-speedtest-ads" >> $GOPATH/src/$GEOSITE_REPO/data/ookla-speedtest
|
2019-12-13 23:26:24 +08:00
|
|
|
|
2020-01-10 14:15:44 +08:00
|
|
|
- name: Get and add direct domains into temp-direct.txt file
|
|
|
|
run: |
|
|
|
|
curl -sSL $CHINA_DOMAINS_URL | awk -F '/' '{print $2}' > temp-direct.txt
|
|
|
|
|
2020-01-10 13:22:40 +08:00
|
|
|
- name: Get and add proxy domains into temp-proxy.txt file
|
2019-12-13 23:26:24 +08:00
|
|
|
run: |
|
2020-01-09 19:00:24 +08:00
|
|
|
curl -sSL $GFWLIST_DOMAINS_URL > temp-proxy.txt
|
2020-01-10 14:15:44 +08:00
|
|
|
curl -sSL $GREATFIRE_DOMAINS_URL >> temp-proxy.txt
|
2020-01-09 19:00:24 +08:00
|
|
|
curl -sSL $GOOGLE_DOMAINS_URL | awk -F '/' '{print $2}' >> temp-proxy.txt
|
|
|
|
curl -sSL $APPLE_DOMAINS_URL | awk -F '/' '{print $2}' >> temp-proxy.txt
|
2020-01-10 16:10:06 +08:00
|
|
|
curl -sSL $PROFILES_URL | awk -F ',' '/^DOMAIN(,|\-SUFFIX,).+PROXY/ {print $2}' >> temp-proxy.txt
|
2020-01-10 14:15:44 +08:00
|
|
|
curl -sSL $GEQ1AN_RULES_APPLE_URL | awk -F ',' '/^(HOST|DOMAIN)(,|\-SUFFIX,).+Apple/ {print $2}' >> temp-proxy.txt
|
|
|
|
curl -sSL $GEQ1AN_RULES_MICROSOFT_URL | awk -F ',' '/^(HOST|DOMAIN)(,|\-SUFFIX,).+Microsoft/ {print $2}' >> temp-proxy.txt
|
|
|
|
curl -sSL $GEQ1AN_RULES_GLOBAL_MEDIA_URL | awk -F ',' '/^(HOST|DOMAIN)(,|\-SUFFIX,).+GMedia/ {print $2}' >> temp-proxy.txt
|
|
|
|
curl -sSL $GEQ1AN_RULES_OUTSIDE_URL | awk -F ',' '/^(HOST|DOMAIN)(,|\-SUFFIX,).+Outside/ {print $2}' >> temp-proxy.txt
|
|
|
|
|
2020-01-10 13:22:40 +08:00
|
|
|
- name: Get and add reject domains into temp-reject.txt file
|
2019-12-14 01:33:23 +08:00
|
|
|
run: |
|
2020-01-10 16:10:06 +08:00
|
|
|
curl -sSL $PROFILES_URL | awk -F ',' '/^DOMAIN(,|\-SUFFIX,).+REJECT/ {print $2}' > temp-reject.txt
|
2020-01-10 14:15:44 +08:00
|
|
|
curl -sSL $GEQ1AN_RULES_REJECT_URL | awk -F ',' '/^(HOST|DOMAIN)(,|\-SUFFIX,).+AdBlock/ {print $2}' >> temp-reject.txt
|
|
|
|
curl -sSL $LHIE1_RULES_REJECT_URL | awk -F ',' '/^DOMAIN(,|\-SUFFIX,).+REJECT/ {print $2}' >> temp-reject.txt
|
2019-12-14 01:33:23 +08:00
|
|
|
|
2020-01-10 13:22:40 +08:00
|
|
|
- name: Add proxy and direct domains from "hidden" branch to appropriate temp files
|
2019-12-23 20:42:11 +08:00
|
|
|
run: |
|
|
|
|
cat proxy.txt >> temp-proxy.txt
|
|
|
|
cat direct.txt >> temp-direct.txt
|
|
|
|
|
2020-01-10 16:10:06 +08:00
|
|
|
- name: Remove repeated domains, sort domains and write domains to appropriate list
|
2019-12-15 18:14:44 +08:00
|
|
|
run: |
|
2020-01-10 16:10:06 +08:00
|
|
|
cat temp-proxy.txt | sort --ignore-case -u > proxy-sort.txt
|
|
|
|
cat temp-direct.txt | sort --ignore-case -u > direct-sort.txt
|
|
|
|
cat temp-reject.txt | sort --ignore-case -u > reject-sort.txt
|
|
|
|
|
|
|
|
- name: Filter valid domains
|
|
|
|
run: |
|
2020-01-10 16:34:59 +08:00
|
|
|
cat proxy-sort.txt | awk '/^([a-zA-Z0-9[.-.][._.]]+\.)+[a-zA-Z0-9[.-.]]+$/{print $0}' > $GOPATH/src/$GEOSITE_REPO/data/proxylist
|
|
|
|
cat proxy-sort.txt | awk '!/^([a-zA-Z0-9[.-.][._.]]+\.)+[a-zA-Z0-9[.-.]]+$/{print $0}' > proxy-filter.txt
|
|
|
|
cat direct-sort.txt | awk '/^([a-zA-Z0-9[.-.][._.]]+\.)+[a-zA-Z0-9[.-.]]+$/{print $0}' > $GOPATH/src/$GEOSITE_REPO/data/directlist
|
|
|
|
cat direct-sort.txt | awk '!/^([a-zA-Z0-9[.-.][._.]]+\.)+[a-zA-Z0-9[.-.]]+$/{print $0}' > direct-filter.txt
|
|
|
|
cat reject-sort.txt | awk '/^([a-zA-Z0-9[.-.][._.]]+\.)+[a-zA-Z0-9[.-.]]+$/{print $0}' > $GOPATH/src/$GEOSITE_REPO/data/rejectlist
|
|
|
|
cat reject-sort.txt | awk '!/^([a-zA-Z0-9[.-.][._.]]+\.)+[a-zA-Z0-9[.-.]]+$/{print $0}' > reject-filter.txt
|
2019-12-15 18:14:44 +08:00
|
|
|
|
2020-01-10 13:22:40 +08:00
|
|
|
- name: Add list into appropriate category file
|
2019-12-15 18:14:44 +08:00
|
|
|
run: |
|
2019-12-15 18:25:24 +08:00
|
|
|
cd $GOPATH/src/$GEOSITE_REPO/data
|
2019-12-15 18:14:44 +08:00
|
|
|
echo "include:proxylist" >> geolocation-\!cn
|
|
|
|
echo "include:directlist" >> cn
|
2020-01-10 11:52:39 +08:00
|
|
|
echo "include:rejectlist" >> category-ads-all
|
2019-12-15 18:14:44 +08:00
|
|
|
|
2019-12-13 23:26:24 +08:00
|
|
|
- name: Build geosite.dat file
|
|
|
|
run: |
|
2019-12-13 23:36:57 +08:00
|
|
|
domain-list-community
|
|
|
|
mv ./dlc.dat ./publish/geosite.dat
|
2020-01-10 16:10:06 +08:00
|
|
|
mv ./*-filter.txt ./publish/
|
2020-01-12 02:11:39 +08:00
|
|
|
cp -f $GOPATH/src/$GEOSITE_REPO/data/{proxy,direct,reject}list ./publish/
|
2019-12-13 23:26:24 +08:00
|
|
|
|
2019-12-14 06:43:12 +08:00
|
|
|
- name: Release dat files
|
2019-12-13 23:26:24 +08:00
|
|
|
uses: Ricky-Hao/action-release@master
|
|
|
|
env:
|
2019-12-13 23:51:37 +08:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2019-12-13 23:26:24 +08:00
|
|
|
ASSET_PATH: publish
|