2020-07-31 05:58:13 +01:00
|
|
|
name: Generate RULE-SET for Premium Edition of Clash
|
|
|
|
on:
|
2020-10-27 04:49:38 +00:00
|
|
|
workflow_dispatch:
|
2020-07-31 05:58:13 +01:00
|
|
|
schedule:
|
|
|
|
- cron: "30 22 * * *"
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
paths-ignore:
|
|
|
|
- "**/README.md"
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Set variables
|
|
|
|
run: |
|
2020-10-06 08:08:20 +01:00
|
|
|
echo "RELEASE_NAME=Released on $(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
|
|
|
echo "TAG_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
2020-10-29 22:49:21 +00:00
|
|
|
echo "custom_icloud=https://raw.githubusercontent.com/Loyalsoldier/domain-list-custom/release/icloud.txt" >> $GITHUB_ENV
|
2020-10-29 23:06:58 +00:00
|
|
|
echo "custom_tld_not_cn=https://raw.githubusercontent.com/Loyalsoldier/domain-list-custom/release/tld-!cn.txt" >> $GITHUB_ENV
|
2021-01-21 08:42:50 +00:00
|
|
|
echo "custom_private=https://raw.githubusercontent.com/Loyalsoldier/domain-list-custom/release/private.txt" >> $GITHUB_ENV
|
2020-10-06 08:08:20 +01:00
|
|
|
echo "Loyalsoldier_reject=https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/reject-list.txt" >> $GITHUB_ENV
|
|
|
|
echo "Loyalsoldier_proxy=https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/proxy-list.txt" >> $GITHUB_ENV
|
|
|
|
echo "Loyalsoldier_direct=https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/direct-list.txt" >> $GITHUB_ENV
|
2020-10-29 23:06:58 +00:00
|
|
|
echo "Loyalsoldier_gfw=https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/gfw.txt" >> $GITHUB_ENV
|
|
|
|
echo "Loyalsoldier_greatfire=https://raw.githubusercontent.com/Loyalsoldier/v2ray-rules-dat/release/greatfire.txt" >> $GITHUB_ENV
|
2020-10-06 08:08:20 +01:00
|
|
|
echo "felixonmars_apple=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf" >> $GITHUB_ENV
|
|
|
|
echo "felixonmars_google=https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf" >> $GITHUB_ENV
|
2021-11-03 10:05:38 +00:00
|
|
|
echo "cn_cidr=https://raw.githubusercontent.com/Loyalsoldier/geoip/release/text/cn.txt" >> $GITHUB_ENV
|
|
|
|
echo "lan_cidr=https://raw.githubusercontent.com/Loyalsoldier/geoip/release/text/private.txt" >> $GITHUB_ENV
|
|
|
|
echo "telegram_cidr=https://raw.githubusercontent.com/Loyalsoldier/geoip/release/text/telegram.txt" >> $GITHUB_ENV
|
2020-07-31 05:58:13 +01:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Checkout the "hidden" branch
|
2022-03-02 08:37:41 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-07-31 05:58:13 +01:00
|
|
|
with:
|
|
|
|
ref: hidden
|
|
|
|
|
|
|
|
- name: Generate icloud.txt file
|
|
|
|
run: |
|
|
|
|
echo "payload:" > icloud.txt
|
2020-10-29 22:49:21 +00:00
|
|
|
curl -sSL ${custom_icloud} | grep -E "^(full|domain):" | awk -F ':' '{printf " - |+.%s|\n", $2}' | sed "s/|/'/g" >> icloud.txt
|
2020-07-31 05:58:13 +01:00
|
|
|
|
|
|
|
- name: Generate google.txt file
|
|
|
|
run: |
|
|
|
|
echo "payload:" > google.txt
|
2020-08-04 03:56:16 +01:00
|
|
|
curl -sSL ${felixonmars_google} | perl -ne '/^server=\/([^\/]+)\// && print " - |+.$1|\n"' | sed "s/|/'/g" >> google.txt
|
2020-07-31 05:58:13 +01:00
|
|
|
|
2020-08-04 03:56:16 +01:00
|
|
|
- name: Generate apple.txt file
|
2020-07-31 05:58:13 +01:00
|
|
|
run: |
|
2020-08-04 03:56:16 +01:00
|
|
|
echo "payload:" > apple.txt
|
2020-10-29 22:49:21 +00:00
|
|
|
curl -sSL ${felixonmars_apple} | perl -ne '/^server=\/([^\/]+)\// && print " - |+.$1|\n"' | sed "s/|/'/g" >> apple.txt
|
2020-07-31 05:58:13 +01:00
|
|
|
|
2021-01-21 08:42:50 +00:00
|
|
|
- name: Generate private.txt file
|
|
|
|
run: |
|
|
|
|
echo "payload:" > private.txt
|
|
|
|
curl -sSL ${custom_private} | awk -F ':' '/^full:/ {printf " - |%s|\n", $2}' | sed "s/|/'/g" >> private.txt
|
|
|
|
curl -sSL ${custom_private} | awk -F ':' '/^domain:/ {printf " - |+.%s|\n", $2}' | sed "s/|/'/g" >> private.txt
|
|
|
|
|
2020-08-04 03:56:16 +01:00
|
|
|
- name: Generate direct.txt file
|
2020-07-31 05:58:13 +01:00
|
|
|
run: |
|
2020-08-04 03:56:16 +01:00
|
|
|
echo "payload:" > direct.txt
|
2021-01-21 09:57:04 +00:00
|
|
|
curl -sSL ${Loyalsoldier_direct} | grep -Ev "^(regexp|keyword):" | perl -ne '/^(full:)([-_a-zA-Z0-9]+(\.[-_a-zA-Z0-9]+)*)/ && print " - |$2|\n"' | sed "s/|/'/g" >> direct.txt
|
2021-02-16 12:00:02 +00:00
|
|
|
curl -sSL ${Loyalsoldier_direct} | grep -Ev "^(regexp|keyword|full):" | perl -ne '/^(domain:)?([-_a-zA-Z0-9]+(\.[-_a-zA-Z0-9]+)*)/ && print " - |+.$2|\n"' | sed "s/|/'/g" >> direct.txt
|
2020-07-31 05:58:13 +01:00
|
|
|
|
2020-08-04 03:56:16 +01:00
|
|
|
- name: Generate proxy.txt file
|
2020-07-31 05:58:13 +01:00
|
|
|
run: |
|
2020-08-04 03:56:16 +01:00
|
|
|
echo "payload:" > proxy.txt
|
2021-01-21 09:57:04 +00:00
|
|
|
curl -sSL ${Loyalsoldier_proxy} | grep -Ev "^(regexp|keyword):" | perl -ne '/^(full:)([-_a-zA-Z0-9]+(\.[-_a-zA-Z0-9]+)*)/ && print " - |$2|\n"' | sed "s/|/'/g" >> proxy.txt
|
2021-02-16 12:00:02 +00:00
|
|
|
curl -sSL ${Loyalsoldier_proxy} | grep -Ev "^(regexp|keyword|full):" | perl -ne '/^(domain:)?([-_a-zA-Z0-9]+(\.[-_a-zA-Z0-9]+)*)/ && print " - |+.$2|\n"' | sed "s/|/'/g" >> proxy.txt
|
2020-07-31 05:58:13 +01:00
|
|
|
|
2020-08-04 03:56:16 +01:00
|
|
|
- name: Generate reject.txt file
|
2020-07-31 05:58:13 +01:00
|
|
|
run: |
|
|
|
|
echo "payload:" > reject.txt
|
2020-11-23 05:44:24 +00:00
|
|
|
curl -sSL ${Loyalsoldier_reject} | grep -Ev "^(regexp|keyword):" | perl -ne '/^(domain:|full:)?([-_a-zA-Z0-9]+(\.[-_a-zA-Z0-9]+)*)/ && print " - |+.$2|\n"' | sed "s/|/'/g" >> reject.txt
|
2020-07-31 05:58:13 +01:00
|
|
|
|
2020-10-29 23:06:58 +00:00
|
|
|
- name: Generate gfw.txt file
|
|
|
|
run: |
|
|
|
|
echo "payload:" > gfw.txt
|
2020-11-23 05:44:24 +00:00
|
|
|
curl -sSL ${Loyalsoldier_gfw} | grep -Ev "^(regexp|keyword):" | perl -ne '/^(domain:|full:)?([-_a-zA-Z0-9]+(\.[-_a-zA-Z0-9]+)*)/ && print " - |+.$2|\n"' | sed "s/|/'/g" >> gfw.txt
|
2020-10-29 23:06:58 +00:00
|
|
|
|
|
|
|
- name: Generate greatfire.txt file
|
|
|
|
run: |
|
|
|
|
echo "payload:" > greatfire.txt
|
2020-11-23 05:44:24 +00:00
|
|
|
curl -sSL ${Loyalsoldier_greatfire} | grep -Ev "^(regexp|keyword):" | perl -ne '/^(domain:|full:)?([-_a-zA-Z0-9]+(\.[-_a-zA-Z0-9]+)*)/ && print " - |+.$2|\n"' | sed "s/|/'/g" >> greatfire.txt
|
2020-10-29 23:06:58 +00:00
|
|
|
|
|
|
|
- name: Generate tld-not-cn.txt file
|
|
|
|
run: |
|
|
|
|
echo "payload:" > tld-not-cn.txt
|
|
|
|
curl -sSL "${custom_tld_not_cn}" | perl -ne '/^domain:([-_a-zA-Z0-9]+(\.[-_a-zA-Z0-9]+)*)/ && print " - |+.$1|\n"' | sed "s/|/'/g" >> tld-not-cn.txt
|
|
|
|
|
2020-08-01 02:07:29 +01:00
|
|
|
- name: Generate cncidr.txt file
|
2020-07-31 05:58:13 +01:00
|
|
|
run: |
|
|
|
|
echo "payload:" > cncidr.txt
|
2021-11-03 10:05:38 +00:00
|
|
|
curl -sSL ${cn_cidr} | perl -ne '/(.+\/\d+)/ && print " - |$1|\n"' | sed "s/|/'/g" >> cncidr.txt
|
2020-07-31 05:58:13 +01:00
|
|
|
|
2020-11-24 07:46:05 +00:00
|
|
|
- name: Generate telegramcidr.txt file
|
|
|
|
run: |
|
2021-11-03 10:05:38 +00:00
|
|
|
echo "payload:" > telegramcidr.txt
|
2020-11-24 07:46:05 +00:00
|
|
|
curl -sSL ${telegram_cidr} | perl -ne '/(.+\/\d+)/ && print " - |$1|\n"' | sed "s/|/'/g" >> telegramcidr.txt
|
|
|
|
|
2021-11-03 10:05:38 +00:00
|
|
|
- name: Generate lancidr.txt file
|
|
|
|
run: |
|
|
|
|
echo "payload:" > lancidr.txt
|
|
|
|
curl -sSL ${lan_cidr} | perl -ne '/(.+\/\d+)/ && print " - |$1|\n"' | sed "s/|/'/g" >> lancidr.txt
|
|
|
|
|
2020-07-31 05:58:13 +01:00
|
|
|
- name: Move files to publish directory
|
|
|
|
run: |
|
|
|
|
mkdir -p publish
|
2021-11-03 10:05:38 +00:00
|
|
|
cp *.txt ./publish/
|
2020-07-31 05:58:13 +01:00
|
|
|
|
|
|
|
- name: Release and upload assets
|
2023-02-08 09:38:26 +00:00
|
|
|
uses: softprops/action-gh-release@v1
|
2020-07-31 05:58:13 +01:00
|
|
|
with:
|
|
|
|
name: ${{ env.RELEASE_NAME }}
|
|
|
|
tag_name: ${{ env.TAG_NAME }}
|
|
|
|
draft: false
|
|
|
|
prerelease: false
|
|
|
|
files: |
|
|
|
|
./publish/*
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Git push assets to "release" branch
|
|
|
|
run: |
|
2021-08-28 12:31:31 +01:00
|
|
|
cd publish || exit 1
|
2020-07-31 05:58:13 +01:00
|
|
|
git init
|
2021-03-19 04:40:06 +00:00
|
|
|
git config --local user.name "github-actions[bot]"
|
|
|
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
2020-07-31 05:58:13 +01:00
|
|
|
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 }}"
|
2020-10-27 04:49:38 +00:00
|
|
|
git push -f origin release
|
2022-08-30 14:17:42 +01:00
|
|
|
|
|
|
|
- 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
|