Skip to content

To Domain

To Domain #493

Workflow file for this run

name: To Domain
on:
workflow_dispatch:
schedule:
- cron: "30 22 * * *"
push:
branches:
- master
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
env:
filterDomain: grep -E "^( - DOMAIN,| - DOMAIN-SUFFIX,)" | sed "s/^ - DOMAIN,//g" | sed "s/^ - DOMAIN-SUFFIX,/+./g"
filterList: grep -E "^(DOMAIN,|DOMAIN-SUFFIX)" | sed "s/^DOMAIN,//g" | sed "s/^DOMAIN-SUFFIX,/+./g"
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 "googleUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Google/Google.yaml" >> $GITHUB_ENV
echo "telegramUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Telegram/Telegram.yaml" >> $GITHUB_ENV
echo "openaiUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/OpenAI/OpenAI.yaml" >> $GITHUB_ENV
echo "youtubeUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/YouTube/YouTube.yaml" >> $GITHUB_ENV
echo "microsoftUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Microsoft/Microsoft.yaml" >> $GITHUB_ENV
echo "fcmUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/GoogleFCM/GoogleFCM.yaml" >> $GITHUB_ENV
echo "facebookUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Facebook/Facebook.yaml" >> $GITHUB_ENV
echo "twitterUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Twitter/Twitter.yaml" >> $GITHUB_ENV
echo "bingUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Bing/Bing.yaml" >> $GITHUB_ENV
echo "proxyUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Proxy/Proxy.list" >> $GITHUB_ENV
echo "binanceUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/Binance/Binance.list" >> $GITHUB_ENV
echo "okxUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/OKX/OKX.list" >> $GITHUB_ENV
echo "trackerUrl=https://raw.githubusercontent.com/blackmatrix7/ios_rule_script/master/rule/Clash/PrivateTracker/PrivateTracker.list" >> $GITHUB_ENV
echo "tracker2Url=https://gitea.com/XIU2/TrackersListCollection/raw/branch/master/all.txt" >> $GITHUB_ENV
shell: bash
- name: Checkout v2fly/domain-list-community
uses: actions/checkout@v4
with:
repository: v2fly/domain-list-community
path: community
- name: Checkout cokebar/gfwlist2dnsmasq
uses: actions/checkout@v4
with:
repository: cokebar/gfwlist2dnsmasq
path: gfwlist2dnsmasq
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version-file: ./community/go.mod
cache-dependency-path: ./community/go.sum
- name: To Domain file
run: |
mkdir -p publish
cd publish || exit 1
curl -sSL ${googleUrl} | ${{ env.filterDomain }} > google.txt
curl -sSL ${telegramUrl} | ${{ env.filterDomain }} > telegram.txt
curl -sSL ${youtubeUrl} | ${{ env.filterDomain }} > youtube.txt
curl -sSL ${microsoftUrl} | ${{ env.filterDomain }} > microsoft.txt
curl -sSL ${fcmUrl} | ${{ env.filterDomain }} > fcm.txt
curl -sSL ${bingUrl} | ${{ env.filterDomain }} > bing.txt
- name: Export Community Lists
run: |
mkdir -p data-list
cd community || exit 1
go run ./ --datapath=./data --outputdir=../data-list --exportlists=category-dev,openai
cd ../ && rm -rf community
- name: Community To Domain
env:
filterDomain: grep -E "^(domain|full)" | sed "s/domain:/+./g" | sed "s/full://g" | sort --ignore-case -u
run: |
cd data-list || exit 1
cat category-dev.txt | ${{ env.filterDomain }} > ../publish/category-dev.txt
- name: Merge Proxy
run: |
cd gfwlist2dnsmasq || exit 1
chmod +x ./gfwlist2dnsmasq.sh
./gfwlist2dnsmasq.sh -l -o gfwlist.txt
cd ../
mkdir -p merge
cd merge || exit 1
curl -sSL ${proxyUrl} | ${{ env.filterList }} > proxy.txt
cat proxy.txt gfwlist.txt | sort --ignore-case -u > ../publish/proxy.txt
- name: Merge Openai
env:
filter2Domain: grep -E "^(domain|full)" | grep -v ":@cn$" | sed "/^full/! s/^domain:/+./g" | sed "s/^full://g" | sed "s/:@ads$//g"
run: |
mkdir -p merge
cd merge || exit 1
curl -sSL ${openaiUrl} | ${{ env.filterDomain }} > openai.txt
cat ../data-list/openai.txt | ${{ env.filter2Domain }} >> openai.txt
cat openai.txt | sort --ignore-case -u > ../publish/openai.txt
cd ../ && rm -rf merge data-list
- name: Merge Social
run: |
mkdir -p merge
cd merge || exit 1
curl -sSL ${facebookUrl} | ${{ env.filterDomain }} > social.txt
curl -sSL ${twitterUrl} | ${{ env.filterDomain }} >> social.txt
cat social.txt | sort --ignore-case -u > ../publish/social.txt
rm -rf ../merge
- name: Merge C2c
run: |
cd publish || exit 1
curl -sSL ${binanceUrl} | ${{ env.filterList }} > c2c.txt
curl -sSL ${okxUrl} | ${{ env.filterList }} >> c2c.txt
- name: Merge Tracker
env:
filterTracker: grep -i "\.[A-Z]" | grep -v tracker | sed 's/^.*\/\//+./g' | sed 's/:.*\/.*//g'
run: |
mkdir -p merge
cd merge || exit 1
curl -sSL ${trackerUrl} | ${{ env.filterList }} > tracker.txt
curl -sSL ${tracker2Url} | ${{ env.filterTracker }} >> tracker.txt
cat tracker.txt | sort --ignore-case -u > ../publish/tracker.txt
rm -rf ../merge
- 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 "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); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@release/${file}"
done