meta-rules-dat/.github/workflows/build.yml

166 lines
6.1 KiB
YAML
Raw Normal View History

name: Build v2ray rules dat files
2019-12-13 15:23:54 +08:00
on:
schedule:
- cron: "0 19 * * *"
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:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: Set GOPATH
run: |
echo "::set-env name=GOPATH::$(dirname $GITHUB_WORKSPACE)"
echo "::set-env name=GREEN::\033[0;32m"
echo "::set-env name=NC::\033[0m"
echo "::set-env name=GEOIP_REPO::github.com/v2ray/geoip"
echo "::set-env name=GEOSITE_REPO::github.com/v2ray/domain-list-community"
2019-12-15 18:14:44 +08:00
echo "::set-env name=GOOGLE_URL::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf"
echo "::set-env name=APPLE_URL::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf"
echo "::set-env name=GFWLIST_URL::https://cokebar.github.io/gfwlist2dnsmasq/gfwlist_domain.txt"
2019-12-14 01:33:23 +08:00
echo "::set-env name=Profiles_URL::https://raw.githubusercontent.com/ConnersHua/Profiles/master/Shadow/Pro.conf"
echo "::set-env name=Blocked_DOMAINS_URL::https://raw.githubusercontent.com/wongsyrone/domain-block-list/master/domains.txt"
echo "::set-env name=CHINA_DOMAINS_URL::https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf"
echo "::add-path::$(dirname $GITHUB_WORKSPACE)/bin"
shell: bash
2019-12-11 02:56:31 +08:00
- name: Get GeoLite2
2019-12-10 15:40:58 +08:00
run: |
curl -sSL -O https://geolite.maxmind.com/download/geoip/database/GeoLite2-Country-CSV.zip
unzip GeoLite2-Country-CSV.zip
rm -f GeoLite2-Country-CSV.zip
mv GeoLite2* geoip
2019-12-10 17:28:39 +08:00
- name: Generate geoip.dat file
run: |
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
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
2019-12-15 18:14:44 +08:00
- name: Get and add gfwlist into temp-proxy.txt file
run: |
2019-12-15 18:14:44 +08:00
cd $GOPATH/src/$GEOSITE_REPO
curl -sSL $GFWLIST_URL > temp-proxy.txt
- name: Get and add google domains into temp-proxy.txt file
run: |
cd $GOPATH/src/$GEOSITE_REPO
curl -sSL $GOOGLE_URL >> temp-proxy.txt
2019-12-15 18:14:44 +08:00
- name: Get and add apple domains into temp-proxy.txt file
2019-12-14 01:33:23 +08:00
run: |
2019-12-15 18:14:44 +08:00
cd $GOPATH/src/$GEOSITE_REPO
curl -sSL $APPLE_URL >> temp-proxy.txt
- name: Get and add proxy domains from @ConnersHua/Profiles into temp-proxy.txt file
run: |
cd $GOPATH/src/$GEOSITE_REPO
curl -sSL $Profiles_URL | awk '/^DOMAIN.+PROXY/' | cut -d ',' -f 2 >> temp-proxy.txt
2019-12-15 18:14:44 +08:00
- name: Get and add blocked domains from @wongsyrone/domain-block-list into temp-proxy.txt file
run: |
2019-12-15 18:14:44 +08:00
cd $GOPATH/src/$GEOSITE_REPO
curl -sSL $Blocked_DOMAINS_URL >> temp-proxy.txt
2019-12-14 01:33:23 +08:00
2019-12-15 18:14:44 +08:00
- name: Get and add direct domains from @ConnersHua/Profiles into temp-direct.txt file
2019-12-14 01:33:23 +08:00
run: |
2019-12-15 18:14:44 +08:00
cd $GOPATH/src/$GEOSITE_REPO
curl -sSL $Profiles_URL | awk '/^DOMAIN.+DIRECT/' | cut -d ',' -f 2 > temp-direct.txt
2019-12-14 01:33:23 +08:00
2019-12-15 18:14:44 +08:00
- name: Get and add chinalist into temp-direct.txt file
run: |
2019-12-15 18:14:44 +08:00
cd $GOPATH/src/$GEOSITE_REPO
curl -sSL $CHINA_DOMAINS_URL | awk -F '/' '{print $2}' >> temp-direct.txt
2019-12-14 01:33:23 +08:00
- name: Get and add reject domains from @ConnersHua/Profiles into category-ads-all
run: |
cd $GOPATH/src/$GEOSITE_REPO/data
2019-12-15 13:09:49 +08:00
curl -sSL $Profiles_URL | awk '/^DOMAIN.+REJECT/' | cut -d ',' -f 2 > profilereject
2019-12-14 01:33:23 +08:00
echo "include:profilereject" >> category-ads-all
2019-12-15 18:14:44 +08:00
- name: Remove repeated domains and write domains to new lists
run: |
cd $GOPATH/src/$GEOSITE_REPO
cat temp-proxy.txt | sort --ignore-case -u > ./data/proxylist
cat temp-direct.txt | sort --ignore-case -u > ./data/directlist
- name: Add lists into appropriate category
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
- name: Build geosite.dat file
run: |
2019-12-13 23:36:57 +08:00
domain-list-community
mv ./dlc.dat ./publish/geosite.dat
- name: List above process results
run: |
2019-12-15 18:18:45 +08:00
echo -e "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}"
2019-12-15 18:14:44 +08:00
echo "list files in geosite folder"
ls -lah $GOPATH/src/$GEOSITE_REPO
2019-12-15 18:18:45 +08:00
echo -e "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}"
echo "list files in data folder"
ls -lah $GOPATH/src/$GEOSITE_REPO/data
2019-12-15 18:18:45 +08:00
echo -e "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}"
echo "list last 10 lines of cn file"
tail -n 10 $GOPATH/src/$GEOSITE_REPO/data/cn
2019-12-15 18:18:45 +08:00
echo -e "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}"
echo "list last 10 lines of geolocation-!cn file"
tail -n 10 $GOPATH/src/$GEOSITE_REPO/data/geolocation-\!cn
2019-12-15 18:18:45 +08:00
echo -e "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}"
echo "list last 10 lines of category-ads-all file"
tail -n 10 $GOPATH/src/$GEOSITE_REPO/data/category-ads-all
2019-12-15 18:18:45 +08:00
echo -e "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}"
echo "list files in publish folder"
ls -lah ./publish
2019-12-15 18:18:45 +08:00
echo -e "${GREEN}>>>>>>>>>>>>>>>>>>>>>>>>${NC}"
echo -e "${GREEN}完成啦!🌈${NC}"
2019-12-13 23:47:55 +08:00
- name: Set release variables
run: |
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-14 06:43:12 +08:00
- name: Release dat files
uses: Ricky-Hao/action-release@master
env:
2019-12-13 23:51:37 +08:00
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ASSET_PATH: publish
2019-12-14 06:43:12 +08:00
- name: Upload dat files
uses: actions/upload-artifact@master
if: success()
with:
name: dat_files
path: publish