Skip to content

Commit

Permalink
修改 Clash 名称
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinWin committed Dec 27, 2024
1 parent 46432c3 commit 53ae6a6
Showing 1 changed file with 61 additions and 61 deletions.
122 changes: 61 additions & 61 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ jobs:
go-version-file: ./custom/go.mod
cache-dependency-path: ./custom/go.sum

- name: Generate `clash` geodata
- name: Generate `mihomo` geodata
run: |
mkdir -p ./community/mydata/
archs1=(private ads microsoft-cn apple-cn google-cn games-cn ai networktest netflix disney max primevideo appletv youtube tiktok bilibili proxy cn)
archs2=(private ads microsoft-cn apple-cn google-cn games-cn ai networktest proxy cn)
# Generate `clash` geosite-all.dat
# Generate `mihomo` geosite-all.dat
for ((i = 0; i < 18; i++)); do
curl -sSL "${domains_download_url}/${archs1[i]}.list" | grep -E 'DOMAIN,|DOMAIN-SUFFIX,|DOMAIN-KEYWORD' | sed -e 's/^DOMAIN,/full:/' -e 's/^DOMAIN-SUFFIX,//' -e 's/^DOMAIN-KEYWORD,/keyword:/' > "./community/mydata/${archs1[i]}"
done
Expand All @@ -61,11 +61,11 @@ jobs:
cd ./community/
go run ./ --datapath=./mydata/ --outputname geosite-all.dat
# Generate `clash` geosite-all-lite.dat
# Generate `mihomo` geosite-all-lite.dat
rm -f ./mydata/ads
go run ./ --datapath=./mydata/ --outputname geosite-all-lite.dat
# Generate `clash` geosite.dat
# Generate `mihomo` geosite.dat
rm -f ./mydata/*
for ((i = 0; i < 10; i++)); do
curl -sSL "${domains_download_url}/${archs2[i]}.list" | grep -E 'DOMAIN,|DOMAIN-SUFFIX,|DOMAIN-KEYWORD' | sed -e 's/^DOMAIN,/full:/' -e 's/^DOMAIN-SUFFIX,//' -e 's/^DOMAIN-KEYWORD,/keyword:/' > "./mydata/${archs2[i]}"
Expand All @@ -79,7 +79,7 @@ jobs:
EOF
go run ./ --datapath=./mydata/ --outputname geosite.dat
# Generate `clash` geosite-lite.dat
# Generate `mihomo` geosite-lite.dat
rm -f ./mydata/ads
go run ./ --datapath=./mydata/ --outputname geosite-lite.dat
Expand All @@ -93,19 +93,19 @@ jobs:
- name: Get geoip relative files
run: |
mkdir -p ./clash/ ./sing-box/
# Download Clash geoip files (.mmdb)
clash_mmdb=($(curl -sSL https://api.github.com/repos/DustinWin/geoip/releases | grep '"browser_download_url"' | grep '.mmdb' | awk -F'"' '{print $4}'))
count_clash_mmdb=${#clash_mmdb[@]}
for ((i = 0; i < count_clash_mmdb; i++)); do
wget -P ./clash/ "${clash_mmdb[i]}"
mkdir -p ./mihomo/ ./sing-box/
# Download mihomo geoip files (.mmdb)
mihomo_mmdb=($(curl -sSL https://api.github.com/repos/DustinWin/geoip/releases | grep '"browser_download_url"' | grep '.mmdb' | awk -F'"' '{print $4}'))
count_mihomo_mmdb=${#mihomo_mmdb[@]}
for ((i = 0; i < count_mihomo_mmdb; i++)); do
wget -P ./mihomo/ "${mihomo_mmdb[i]}"
done
# Download Clash other geoip files (except .mmdb)
clash_others=($(curl -sSL https://api.github.com/repos/DustinWin/geoip/releases | grep '"browser_download_url"' | grep '/clash/' | grep -v '.mmdb' | awk -F'"' '{print $4}'))
count_clash_others=${#clash_others[@]}
for ((i = 0; i < count_clash_others; i++)); do
wget -P ./community/ "${clash_others[i]}"
# Download mihomo other geoip files (except .mmdb)
mihomo_others=($(curl -sSL https://api.github.com/repos/DustinWin/geoip/releases | grep '"browser_download_url"' | grep '/mihomo/' | grep -v '.mmdb' | awk -F'"' '{print $4}'))
count_mihomo_others=${#mihomo_others[@]}
for ((i = 0; i < count_mihomo_others; i++)); do
wget -P ./community/ "${mihomo_others[i]}"
done
# Download sing-box all geoip files
Expand All @@ -115,60 +115,60 @@ jobs:
wget -P ./community/ "${singbox_all[i]}"
done
- name: Move `clash` and `sing-box` geodata files
- name: Move `mihomo` and `sing-box` geodata files
run: |
cd ./community/ || exit 1
for file in $(ls *.dat *.metadb); do
install -Dp "./${file}" ../clash/
install -Dp "./${file}" ../mihomo/
done
for file in $(ls *.db); do
install -Dp "./${file}" ../sing-box/
done
rm -rf ../custom* ../community*
- name: Generate `clash` rule-set
- name: Generate `mihomo` rule-set
run: |
mkdir -p ./clash-ruleset/
mkdir -p ./mihomo-ruleset/
domains=(private ads microsoft-cn apple-cn google-cn games-cn ai netflix disney max primevideo appletv youtube tiktok bilibili proxy cn)
archs=(applications networktest)
ips=(netflixip telegramip privateip cnip)
# Generate `clash` rule-set (yaml)
# Generate `mihomo` rule-set (yaml)
for ((i = 0; i < 17; i++)); do
echo 'payload:' > "./clash-ruleset/${domains[i]}.yaml"
curl -sSL "${domains_download_url}/${domains[i]}.list" | grep -E 'DOMAIN,|DOMAIN-SUFFIX,' | sed -e "s/^DOMAIN,/ - '/" -e "s/^DOMAIN-SUFFIX,/ - '+\./" -e "s/$/'/" >> "./clash-ruleset/${domains[i]}.yaml"
echo 'payload:' > "./mihomo-ruleset/${domains[i]}.yaml"
curl -sSL "${domains_download_url}/${domains[i]}.list" | grep -E 'DOMAIN,|DOMAIN-SUFFIX,' | sed -e "s/^DOMAIN,/ - '/" -e "s/^DOMAIN-SUFFIX,/ - '+\./" -e "s/$/'/" >> "./mihomo-ruleset/${domains[i]}.yaml"
done
echo 'payload:' > "./clash-ruleset/fakeip-filter.yaml"
curl -sSL "${domains_download_url}/fakeip-filter.list" | sed -e "s/^DOMAIN,/ - '/" -e "s/^DOMAIN-SUFFIX,/ - '+\./" -e "s/^DOMAIN-REGEX,/ - '/" -e "s/'\./'/" -e "s/$/'/" >> ./clash-ruleset/fakeip-filter.yaml
echo 'payload:' > "./clash-ruleset/fakeip-filter-lite.yaml"
curl -sSL "${domains_download_url}/fakeip-filter-lite.list" | sed -e "s/^DOMAIN,/ - '/" -e "s/^DOMAIN-SUFFIX,/ - '+\./" -e "s/^DOMAIN-REGEX,/ - '/" -e "s/'\./'/" -e "s/$/'/" >> ./clash-ruleset/fakeip-filter-lite.yaml
echo 'payload:' > "./mihomo-ruleset/fakeip-filter.yaml"
curl -sSL "${domains_download_url}/fakeip-filter.list" | sed -e "s/^DOMAIN,/ - '/" -e "s/^DOMAIN-SUFFIX,/ - '+\./" -e "s/^DOMAIN-REGEX,/ - '/" -e "s/'\./'/" -e "s/$/'/" >> ./mihomo-ruleset/fakeip-filter.yaml
echo 'payload:' > "./mihomo-ruleset/fakeip-filter-lite.yaml"
curl -sSL "${domains_download_url}/fakeip-filter-lite.list" | sed -e "s/^DOMAIN,/ - '/" -e "s/^DOMAIN-SUFFIX,/ - '+\./" -e "s/^DOMAIN-REGEX,/ - '/" -e "s/'\./'/" -e "s/$/'/" >> ./mihomo-ruleset/fakeip-filter-lite.yaml
for ((i = 0; i < 2; i++)); do
echo 'payload:' > "./clash-ruleset/${archs[i]}.yaml"
curl -sSL "${domains_download_url}/${archs[i]}.list" | sed 's/^/ - /' >> "./clash-ruleset/${archs[i]}.yaml"
echo 'payload:' > "./mihomo-ruleset/${archs[i]}.yaml"
curl -sSL "${domains_download_url}/${archs[i]}.list" | sed 's/^/ - /' >> "./mihomo-ruleset/${archs[i]}.yaml"
done
for ((i = 0; i < 4; i++)); do
echo 'payload:' > "./clash-ruleset/${ips[i]}.yaml"
curl -sSL "${ips_download_url}/${ips[i]}.list" | grep 'IP-CIDR' | sed -e "s/^IP-CIDR,/ - '/" -e "s/^IP-CIDR6,/ - '/" -e "s/$/'/" >> "./clash-ruleset/${ips[i]}.yaml"
echo 'payload:' > "./mihomo-ruleset/${ips[i]}.yaml"
curl -sSL "${ips_download_url}/${ips[i]}.list" | grep 'IP-CIDR' | sed -e "s/^IP-CIDR,/ - '/" -e "s/^IP-CIDR6,/ - '/" -e "s/$/'/" >> "./mihomo-ruleset/${ips[i]}.yaml"
done
# Generate `clash` rule-set (text)
# Generate `mihomo` rule-set (text)
for ((i = 0; i < 17; i++)); do
curl -sSL "${domains_download_url}/${domains[i]}.list" | grep -E 'DOMAIN,|DOMAIN-SUFFIX,' | sed -e 's/^DOMAIN,//' -e 's/^DOMAIN-SUFFIX,/+\./' > "./clash-ruleset/${domains[i]}.list"
curl -sSL "${domains_download_url}/${domains[i]}.list" | grep -E 'DOMAIN,|DOMAIN-SUFFIX,' | sed -e 's/^DOMAIN,//' -e 's/^DOMAIN-SUFFIX,/+\./' > "./mihomo-ruleset/${domains[i]}.list"
done
curl -sSL "${domains_download_url}/fakeip-filter.list" | sed -e 's/^DOMAIN,//' -e 's/^DOMAIN-SUFFIX,/+\./' -e 's/^DOMAIN-REGEX,//' -e 's/^\.//' > ./clash-ruleset/fakeip-filter.list
curl -sSL "${domains_download_url}/fakeip-filter-lite.list" | sed -e 's/^DOMAIN,//' -e 's/^DOMAIN-SUFFIX,/+\./' -e 's/^DOMAIN-REGEX,//' -e 's/^\.//' > ./clash-ruleset/fakeip-filter-lite.list
curl -sSL "${domains_download_url}/fakeip-filter.list" | sed -e 's/^DOMAIN,//' -e 's/^DOMAIN-SUFFIX,/+\./' -e 's/^DOMAIN-REGEX,//' -e 's/^\.//' > ./mihomo-ruleset/fakeip-filter.list
curl -sSL "${domains_download_url}/fakeip-filter-lite.list" | sed -e 's/^DOMAIN,//' -e 's/^DOMAIN-SUFFIX,/+\./' -e 's/^DOMAIN-REGEX,//' -e 's/^\.//' > ./mihomo-ruleset/fakeip-filter-lite.list
for ((i = 0; i < 2; i++)); do
curl -sSL "${domains_download_url}/${archs[i]}.list" > "./clash-ruleset/${archs[i]}.list"
curl -sSL "${domains_download_url}/${archs[i]}.list" > "./mihomo-ruleset/${archs[i]}.list"
done
for ((i = 0; i < 4; i++)); do
curl -sSL "${ips_download_url}/${ips[i]}.list" | grep 'IP-CIDR' | sed -e 's/^IP-CIDR,//' -e 's/^IP-CIDR6,//' > "./clash-ruleset/${ips[i]}.list"
curl -sSL "${ips_download_url}/${ips[i]}.list" | grep 'IP-CIDR' | sed -e 's/^IP-CIDR,//' -e 's/^IP-CIDR6,//' > "./mihomo-ruleset/${ips[i]}.list"
done
# Ready for generate `clash` rule-set (mrs)
# Ready for generate `mihomo` rule-set (mrs)
for ((i = 0; i < 17; i++)); do
mkdir -p "./tools/domains/${domains[i]}/"
curl "${domains_download_url}/${domains[i]}.list" | grep -E 'DOMAIN,|DOMAIN-SUFFIX,' | sed -e 's/^DOMAIN,//' -e 's/^DOMAIN-SUFFIX,/+\./' > "./tools/domains/${domains[i]}/${domains[i]}.list"
Expand Down Expand Up @@ -210,27 +210,27 @@ jobs:
- name: Download and unzip `mihomo` core
run: |
wget https://github.com/DustinWin/clash_singbox-tools/releases/download/mihomo/mihomo-alpha-linux-amd64.tar.gz -O - | tar -zxf - -C ./tools/
wget https://github.com/DustinWin/proxy-tools/releases/download/mihomo/mihomo-alpha-linux-amd64.tar.gz -O - | tar -zxf - -C ./tools/
mv -f ./tools/CrashCore ./tools/mihomo
- name: Generate `clash` rule-set (mrs)
- name: Generate `mihomo` rule-set (mrs)
run: |
cd ./tools/
chmod +x ./mihomo
list=($(ls ./domains/))
for ((i = 0; i < ${#list[@]}; i++)); do
./mihomo convert-ruleset domain text "./domains/${list[i]}/${list[i]}.list" ../clash-ruleset/${list[i]}.mrs
./mihomo convert-ruleset domain text "./domains/${list[i]}/${list[i]}.list" ../mihomo-ruleset/${list[i]}.mrs
done
list=($(ls ./ips/))
for ((i = 0; i < ${#list[@]}; i++)); do
./mihomo convert-ruleset ipcidr text "./ips/${list[i]}/${list[i]}.list" ../clash-ruleset/${list[i]}.mrs
./mihomo convert-ruleset ipcidr text "./ips/${list[i]}/${list[i]}.list" ../mihomo-ruleset/${list[i]}.mrs
done
rm -rf ./mihomo* ./domains/ ./ips/
- name: Download and unzip `sing-box` core
run: |
wget https://github.com/DustinWin/clash_singbox-tools/releases/download/sing-box/sing-box-release-linux-amd64.tar.gz -O - | tar -zxf - -C ./tools/
wget https://github.com/DustinWin/proxy-tools/releases/download/sing-box/sing-box-release-linux-amd64.tar.gz -O - | tar -zxf - -C ./tools/
mv -f ./tools/CrashCore ./tools/sing-box
- name: Generate `sing-box` rule_set
Expand All @@ -242,42 +242,42 @@ jobs:
rm -rf ./sing-box* ./rules*
mv -f ./*.json ./*.srs ../sing-box-ruleset/
- name: Release and upload `clash` assets
- name: Release and upload `mihomo` assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: clash
tag: clash
release_name: mihomo
tag: mihomo
overwrite: true
body: |
Clash 和 [mihomo](https://github.com/MetaCubeX/mihomo) geodata 文件
[mihomo](https://github.com/MetaCubeX/mihomo) geodata 文件
geodata 文件更新于 ${{ env.update_version }}
file_glob: true
file: ./clash/*
file: ./mihomo/*

- name: Release and upload `clash-ruleset` assets
- name: Release and upload `mihomo-ruleset` assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
release_name: clash-ruleset
tag: clash-ruleset
release_name: mihomo-ruleset
tag: mihomo-ruleset
overwrite: true
body: |
Clash 和 [mihomo](https://github.com/MetaCubeX/mihomo) rule-set 规则集文件
[mihomo](https://github.com/MetaCubeX/mihomo) rule-set 规则集文件
规则集文件更新于 ${{ env.update_version }}
file_glob: true
file: ./clash-ruleset/*
file: ./mihomo-ruleset/*

- name: Commit and push `clash-ruleset` branch
- name: Commit and push `mihomo-ruleset` branch
run: |
cd ./clash-ruleset/ || exit 1
cd ./mihomo-ruleset/ || exit 1
git init
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git checkout -b clash-ruleset
git checkout -b mihomo-ruleset
git add . && git commit -m "规则集文件更新于 ${update_version}"
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
git push -f -u origin clash-ruleset
git push -f -u origin mihomo-ruleset
- name: Release and upload `sing-box` assets
uses: svenstaro/upload-release-action@v2
Expand Down Expand Up @@ -318,17 +318,17 @@ jobs:
- name: Purge jsDelivr CDN
run: |
cd ./clash/ || exit 1
cd ./mihomo/ || exit 1
for file in $(ls); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@clash/${file}"
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@mihomo/${file}"
done
cd ../sing-box/ || exit 1
for file in $(ls); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@sing-box/${file}"
done
cd ../clash-ruleset/ || exit 1
cd ../mihomo-ruleset/ || exit 1
for file in $(ls); do
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@clash-ruleset/${file}"
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@mihomo-ruleset/${file}"
done
cd ../sing-box-ruleset/ || exit 1
for file in $(ls); do
Expand Down

0 comments on commit 53ae6a6

Please sign in to comment.