mirror of
https://github.com/Loyalsoldier/v2ray-rules-dat.git
synced 2026-11-27 07:54:48 +03:00
CI & Docs: refine workflow & README (#530)
Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com> Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
+40
-32
@@ -8,11 +8,19 @@ on:
|
||||
- master
|
||||
paths-ignore:
|
||||
- "**/README.md"
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths-ignore:
|
||||
- "**/README.md"
|
||||
permissions:
|
||||
contents: write
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Set variables
|
||||
run: |
|
||||
@@ -74,27 +82,27 @@ jobs:
|
||||
|
||||
- name: Get and add direct domains into temp-direct.txt file
|
||||
run: |
|
||||
curl -sSL $CHINA_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > temp-direct.txt
|
||||
curl -sSL ${CUSTOM_DIRECT} | perl -ne '/^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-direct.txt
|
||||
curl -L --retry 3 --fail-with-body "$CHINA_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > temp-direct.txt
|
||||
curl -L --retry 3 --fail-with-body "$CUSTOM_DIRECT" | perl -ne '/^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-direct.txt
|
||||
|
||||
- name: Get and add proxy domains into temp-proxy.txt file
|
||||
run: |
|
||||
cat ./gfwlist2dnsmasq/temp-gfwlist.txt | perl -ne '/^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/ && print "$1\n"' > temp-proxy.txt
|
||||
curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt
|
||||
curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt
|
||||
curl -sSL ${CUSTOM_PROXY} | grep -Ev ":@cn" | perl -ne '/^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-proxy.txt
|
||||
curl -L --retry 3 --fail-with-body "$GOOGLE_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt
|
||||
curl -L --retry 3 --fail-with-body "$APPLE_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' >> temp-proxy.txt
|
||||
curl -L --retry 3 --fail-with-body "$CUSTOM_PROXY" | perl -ne 'next if /:\@cn/; /^(domain):([^:]+)(\n$|:@.+)/ && print "$2\n"' >> temp-proxy.txt
|
||||
|
||||
- name: Get and add reject domains into temp-reject.txt file
|
||||
run: |
|
||||
curl -sSL $EASYLISTCHINA_EASYLIST_REJECT_URL | perl -ne '/^\|\|([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})\^$/ && print "$1\n"' | perl -ne 'print if not /^[0-9]{1,3}(\.[0-9]{1,3}){3}$/' > temp-reject.txt
|
||||
curl -sSL $ADGUARD_DNS_REJECT_URL | perl -ne '/^\|\|([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})\^$/ && print "$1\n"' | perl -ne 'print if not /^[0-9]{1,3}(\.[0-9]{1,3}){3}$/' >> temp-reject.txt
|
||||
curl -sSL $PETERLOWE_REJECT_URL | perl -ne '/^127\.0\.0\.1\s([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})$/ && print "$1\n"' >> temp-reject.txt
|
||||
curl -sSL $DANPOLLOCK_REJECT_URL | perl -ne '/^127\.0\.0\.1\s([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})/ && print "$1\n"' | sed '1d' >> temp-reject.txt
|
||||
curl -L --retry 3 --fail-with-body "$EASYLISTCHINA_EASYLIST_REJECT_URL" | perl -ne '/^\|\|([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})\^$/ && print "$1\n"' | perl -ne 'print if not /^[0-9]{1,3}(\.[0-9]{1,3}){3}$/' > temp-reject.txt
|
||||
curl -L --retry 3 --fail-with-body "$ADGUARD_DNS_REJECT_URL" | perl -ne '/^\|\|([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})\^$/ && print "$1\n"' | perl -ne 'print if not /^[0-9]{1,3}(\.[0-9]{1,3}){3}$/' >> temp-reject.txt
|
||||
curl -L --retry 3 --fail-with-body "$PETERLOWE_REJECT_URL" | perl -ne '/^127\.0\.0\.1\s([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})$/ && print "$1\n"' >> temp-reject.txt
|
||||
curl -L --retry 3 --fail-with-body "$DANPOLLOCK_REJECT_URL" | perl -ne '/^127\.0\.0\.1\s([-_0-9a-zA-Z]+(\.[-_0-9a-zA-Z]+){1,64})/ && print "$1\n"' | sed '1d' >> temp-reject.txt
|
||||
|
||||
- name: Reserve `full`, `regexp` and `keyword` type of rules from custom lists to "reserve" files
|
||||
run: |
|
||||
curl -sSL ${CUSTOM_DIRECT} | perl -ne '/^((full|regexp|keyword):[^:]+)(\n$|:@.+)/ && print "$1\n"' | sort --ignore-case -u > direct-reserve.txt
|
||||
curl -sSL ${CUSTOM_PROXY} | grep -Ev ":@cn" | perl -ne '/^((full|regexp|keyword):[^:]+)(\n$|:@.+)/ && print "$1\n"' | sort --ignore-case -u > proxy-reserve.txt
|
||||
curl -L --retry 3 --fail-with-body "$CUSTOM_DIRECT" | perl -ne '/^((full|regexp|keyword):[^:]+)(\n$|:@.+)/ && print "$1\n"' | sort --ignore-case -u > direct-reserve.txt
|
||||
curl -L --retry 3 --fail-with-body "$CUSTOM_PROXY" | perl -ne 'next if /:\@cn/; /^((full|regexp|keyword):[^:]+)(\n$|:@.+)/ && print "$1\n"' | sort --ignore-case -u > proxy-reserve.txt
|
||||
|
||||
- name: Add proxy, direct and reject domains from "hidden" branch to appropriate temp files
|
||||
run: |
|
||||
@@ -117,18 +125,15 @@ jobs:
|
||||
[ ! -f "direct-list-deleted-unsort" ] && touch direct-list-deleted-unsort
|
||||
[ ! -f "proxy-list-deleted-unsort" ] && touch proxy-list-deleted-unsort
|
||||
[ ! -f "reject-list-deleted-unsort" ] && touch reject-list-deleted-unsort
|
||||
sort ./direct-list-deleted-unsort > ./direct-list-deleted-sort
|
||||
sort ./proxy-list-deleted-unsort > ./proxy-list-deleted-sort
|
||||
sort ./reject-list-deleted-unsort > ./reject-list-deleted-sort
|
||||
diff ./direct-list-deleted-sort ./direct-list-with-redundant | awk '/^>/{print $2}' > ./direct-list-without-redundant
|
||||
diff ./proxy-list-deleted-sort ./proxy-list-with-redundant | awk '/^>/{print $2}' > ./proxy-list-without-redundant
|
||||
diff ./reject-list-deleted-sort ./reject-list-with-redundant | awk '/^>/{print $2}' > ./reject-list-without-redundant
|
||||
grep -Fvxif ./direct-list-deleted-unsort ./direct-list-with-redundant > ./direct-list-without-redundant || [ "$?" -eq 1 ]
|
||||
grep -Fvxif ./proxy-list-deleted-unsort ./proxy-list-with-redundant > ./proxy-list-without-redundant || [ "$?" -eq 1 ]
|
||||
grep -Fvxif ./reject-list-deleted-unsort ./reject-list-with-redundant > ./reject-list-without-redundant || [ "$?" -eq 1 ]
|
||||
|
||||
- name: Remove domains from "need-to-remove" lists in "hidden" branch
|
||||
run: |
|
||||
diff ./direct-need-to-remove.txt ./direct-list-without-redundant | awk '/^>/{print $2}' > temp-cn.txt
|
||||
diff ./proxy-need-to-remove.txt ./proxy-list-without-redundant | awk '/^>/{print $2}' > temp-geolocation-\!cn.txt
|
||||
diff ./reject-need-to-remove.txt ./reject-list-without-redundant | awk '/^>/{print $2}' > temp-category-ads-all.txt
|
||||
grep -Fvxif ./direct-need-to-remove.txt ./direct-list-without-redundant > temp-cn.txt || [ "$?" -eq 1 ]
|
||||
grep -Fvxif ./proxy-need-to-remove.txt ./proxy-list-without-redundant > temp-geolocation-\!cn.txt || [ "$?" -eq 1 ]
|
||||
grep -Fvxif ./reject-need-to-remove.txt ./reject-list-without-redundant > temp-category-ads-all.txt || [ "$?" -eq 1 ]
|
||||
|
||||
- name: Write lists to data directory
|
||||
run: |
|
||||
@@ -150,21 +155,21 @@ jobs:
|
||||
|
||||
- name: Create `china-list`、`google-cn`、`apple-cn`、`gfw`、`greatfire` lists
|
||||
run: |
|
||||
curl -sSL $CHINA_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > ./community/data/china-list
|
||||
curl -sSL $CHINA_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > china-list.txt
|
||||
curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > ./community/data/google-cn
|
||||
curl -sSL $GOOGLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > google-cn.txt
|
||||
curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > ./community/data/apple-cn
|
||||
curl -sSL $APPLE_DOMAINS_URL | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > apple-cn.txt
|
||||
curl -L --retry 3 --fail-with-body "$CHINA_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > ./community/data/china-list
|
||||
curl -L --retry 3 --fail-with-body "$CHINA_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "$1\n"' > china-list.txt
|
||||
curl -L --retry 3 --fail-with-body "$GOOGLE_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > ./community/data/google-cn
|
||||
curl -L --retry 3 --fail-with-body "$GOOGLE_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > google-cn.txt
|
||||
curl -L --retry 3 --fail-with-body "$APPLE_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > ./community/data/apple-cn
|
||||
curl -L --retry 3 --fail-with-body "$APPLE_DOMAINS_URL" | perl -ne '/^server=\/([^\/]+)\// && print "full:$1\n"' > apple-cn.txt
|
||||
cat ./gfwlist2dnsmasq/temp-gfwlist.txt | perl -ne '/^((?=^.{3,255})[a-zA-Z0-9][-_a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-_a-zA-Z0-9]{0,62})+)/ && print "$1\n"' >> ./community/data/gfw
|
||||
cat ./community/data/gfw | sort --ignore-case -u > gfw.txt
|
||||
cat ./community/data/greatfire | sort --ignore-case -u > greatfire.txt
|
||||
curl -sSL $WIN_SPY | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-spy
|
||||
curl -sSL $WIN_SPY | grep "0.0.0.0" | awk '{print $2}' > win-spy.txt
|
||||
curl -sSL $WIN_UPDATE | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-update
|
||||
curl -sSL $WIN_UPDATE | grep "0.0.0.0" | awk '{print $2}' > win-update.txt
|
||||
curl -sSL $WIN_EXTRA | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-extra
|
||||
curl -sSL $WIN_EXTRA | grep "0.0.0.0" | awk '{print $2}' > win-extra.txt
|
||||
curl -L --retry 3 --fail-with-body "$WIN_SPY" | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-spy
|
||||
curl -L --retry 3 --fail-with-body "$WIN_SPY" | grep "0.0.0.0" | awk '{print $2}' > win-spy.txt
|
||||
curl -L --retry 3 --fail-with-body "$WIN_UPDATE" | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-update
|
||||
curl -L --retry 3 --fail-with-body "$WIN_UPDATE" | grep "0.0.0.0" | awk '{print $2}' > win-update.txt
|
||||
curl -L --retry 3 --fail-with-body "$WIN_EXTRA" | grep "0.0.0.0" | awk '{print $2}' > ./community/data/win-extra
|
||||
curl -L --retry 3 --fail-with-body "$WIN_EXTRA" | grep "0.0.0.0" | awk '{print $2}' > win-extra.txt
|
||||
|
||||
- name: Build geosite.dat file
|
||||
run: |
|
||||
@@ -185,6 +190,7 @@ jobs:
|
||||
sha256sum rules.zip > rules.zip.sha256sum
|
||||
|
||||
- name: Release and upload assets
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -194,6 +200,7 @@ jobs:
|
||||
file: ./publish/*
|
||||
|
||||
- name: Git push assets to "release" branch
|
||||
if: github.event_name != 'pull_request'
|
||||
run: |
|
||||
cd publish || exit 1
|
||||
git init
|
||||
@@ -206,6 +213,7 @@ jobs:
|
||||
git push -f -u origin release
|
||||
|
||||
- name: Purge jsdelivr CDN
|
||||
if: github.event_name != 'pull_request'
|
||||
run: |
|
||||
cd publish || exit 1
|
||||
for file in $(ls); do
|
||||
|
||||
Reference in New Issue
Block a user