Release #120
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
schedule: | |
- cron: '0 0 * * Mon' | |
workflow_dispatch: | |
jobs: | |
crawl: | |
name: Crawl Domains | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10.6' | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21 | |
cache: false | |
- name: Env | |
run: | | |
echo "TAG_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV | |
echo "RELEASE_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
sudo apt update | |
sudo apt install libxml2-dev libxslt-dev -y | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Run python program | |
run: | | |
python src/main.py | |
- name: Check result files | |
run: | | |
total=$(wc -l output/domains.txt | awk 'END {print $1}') | |
old=$(curl -sSL --connect-timeout 5 -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/bootmortis/iran-hosted-domains/releases/latest | grep "body" | cut -d\" -f4 | cut -d " " -f1) | |
echo "total $total" | |
echo "old $old" | |
echo "TOTAL_DOMAINS=$total" >> $GITHUB_ENV | |
- name: Build .dat file | |
run: | | |
git clone https://github.com/v2fly/domain-list-community | |
rm -rf domain-list-community/data/* | |
python3 src/data/custom_domains.py | jq -r '.proxy | join("\n")' > domain-list-community/data/proxy | |
mv output/ir_domains.txt domain-list-community/data/ir | |
mv output/other_domains.txt domain-list-community/data/other | |
cp src/data/tld_ir.txt domain-list-community/data/tld-ir | |
cp src/data/all.txt domain-list-community/data/all | |
mv output/ads.txt domain-list-community/data/ads | |
cd domain-list-community | |
go run ./ --outputdir=../output | |
cd ../output | |
mv dlc.dat iran.dat | |
- name: Build sing-box .db file | |
run: | | |
git clone https://github.com/bootmortis/sing-geosite | |
cp output/iran.dat sing-geosite/data/iran.dat | |
cd sing-geosite | |
go run -v . | |
mv iran-geosite.db ../output/iran-geosite.db | |
cd rule-set | |
for file in *; do | |
sha256sum $file > $file.sha256 | |
done | |
- name: Calculate checksum | |
run: | | |
cd output | |
for file in *; do | |
sha256sum $file > $file.sha256 | |
done | |
- name: Upload singbox-geosite result as release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "sing-geosite/rule-set/*.*" | |
repo: sing-geosite | |
body: "${{ env.TOTAL_DOMAINS }} Domains" | |
token: ${{ secrets.SINGBOX_REPO_TOKEN }} | |
tag: ${{ env.TAG_NAME }} | |
name: ${{ env.RELEASE_NAME }} | |
- name: Upload iran-hosted result as release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "output/*.*" | |
body: "${{ env.TOTAL_DOMAINS }} Domains" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ env.TAG_NAME }} | |
name: ${{ env.RELEASE_NAME }} |