Compare commits

..

No commits in common. "7db6bdaf3d474d373baec7210c8902eaa0de5e09" and "e307a33a1360a5afc1440bb22137f01b979c4024" have entirely different histories.

9 changed files with 46 additions and 72 deletions

View File

@ -6,16 +6,16 @@ steps:
- name: generate - name: generate
image: golang:1.19-alpine image: golang:1.19-alpine
commands: commands:
- apk add --no-cache make curl grep libidn sipcalc gawk git patch bash python3 - apk add --no-cache curl grep libidn sipcalc gawk git patch bash python3
- make all - bash generate.sh
- name: create release tag - name: create release tag
image: alpine:latest image: alpine:latest
environment: environment:
GITEA_API_KEY: GITEA_API_KEY:
from_secret: gitea_api_key from_secret: gitea_api_key
commands: commands:
- apk add --no-cache make curl - apk add --no-cache curl
- make release - sh tag.sh
when: when:
branch: branch:
- master - master
@ -25,7 +25,7 @@ steps:
api_key: api_key:
from_secret: gitea_api_key from_secret: gitea_api_key
base_url: https://gitea.neur0tx.site base_url: https://gitea.neur0tx.site
files: .build/* files: .temp/result/*
checksum: checksum:
- sha256 - sha256
when: when:

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
.build .temp
.tool-versions .tool-versions

9
.gitmodules vendored
View File

@ -1,9 +0,0 @@
[submodule "antizapret-pac-generator-light"]
path = antizapret-pac-generator-light
url = https://bitbucket.org/anticensority/antizapret-pac-generator-light.git
[submodule "geoip"]
path = geoip
url = https://github.com/v2fly/geoip.git
[submodule "domain-list-community"]
path = domain-list-community
url = https://github.com/v2fly/domain-list-community.git

View File

@ -1,54 +0,0 @@
SHELL = /bin/bash -o pipefail
export PATH := $(shell go env GOPATH)/bin:$(PATH)
ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
BUILD_DIR=$(ROOT_DIR)/.build
AZ_DIR=$(ROOT_DIR)/antizapret-pac-generator-light
GEOIP_DIR=$(ROOT_DIR)/geoip
GEOSITE_DIR=$(ROOT_DIR)/domain-list-community
DATA_DIR=$(ROOT_DIR)/data
.PHONY: all submodules az geoip geosite release
all: submodules az geoip geosite
@echo Done.
submodules:
@git submodule update --init --recursive
builddir:
ifeq (,$(wildcard $(BUILD_DIR)))
@mkdir -p $(BUILD_DIR)
endif
az: builddir
@bash -c 'set -euo pipefail; \
cd $(AZ_DIR) && \
patch --forward < $(DATA_DIR)/az-cyrillic-idn-fix.patch || true && \
./update.sh && \
./parse.sh'
geoip: builddir
@cat $(DATA_DIR)/geoip-generator-config.json > $(GEOIP_DIR)/config.json
@mkdir -p $(GEOIP_DIR)/data
@cp $(AZ_DIR)/result/iplist_all.txt $(GEOIP_DIR)/data/ru-blocked-ips-all
@cp $(AZ_DIR)/result/iplist_blockedbyip.txt $(GEOIP_DIR)/data/ru-blocked-ips-directblock
@cp $(AZ_DIR)/result/iplist_blockedbyip_noid2971.txt $(GEOIP_DIR)/data/ru-blocked-ips-noid2971
ifeq (,$(wildcard $(GEOIP_DIR)/geoip-src.dat))
@curl -fsSL https://github.com/v2fly/geoip/releases/latest/download/geoip.dat -o $(GEOIP_DIR)/geoip-src.dat
endif
@cd $(GEOIP_DIR) && go run ./
@mv $(GEOIP_DIR)/output/dat/geoip.dat $(BUILD_DIR)/geoip.dat
geosite: builddir
@cp $(AZ_DIR)/result/hostlist_zones.txt $(GEOSITE_DIR)/data/category-ru-blocked-zones
@cp $(AZ_DIR)/result/hostlist_original.txt $(GEOSITE_DIR)/data/category-ru-blocked-domains
@cd $(GEOSITE_DIR) && go run ./ --outputdir=$(BUILD_DIR) --outputname=geosite.dat
VERSION := $(shell date +%Y%m%d%H%M%S)
release:
@echo Tagging as $(VERSION)
@curl -X POST \
https://gitea.neur0tx.site/api/v1/repos/xray-addons/geoip-geosite-with-ru-blocklist/tags?token=${GITEA_API_KEY} \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"message": "$(VERSION)": daily release from ci","tag_name": "$(VERSION)","target": "master"}'

@ -1 +0,0 @@
Subproject commit f14aa53cc0b67fd5d7eac8b7dc6d7f3d75e8c0c9

@ -1 +0,0 @@
Subproject commit ea255cb1730b4f29f5a226f234243493fa143cd4

28
generate.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
set -euxo pipefail
mkdir -p .temp/result
[ ! -d .temp/az ] && \
git clone --depth=1 https://bitbucket.org/anticensority/antizapret-pac-generator-light.git .temp/az && \
cd .temp/az && \
patch < ../../data/az-cyrillic-idn-fix.patch && \
bash update.sh && \
bash parse.sh && \
cd ../..
[ ! -d .temp/geoip ] && \
git clone --depth=1 https://github.com/v2fly/geoip.git .temp/geoip && \
cat data/geoip-generator-config.json > .temp/geoip/config.json && \
cd .temp/geoip && \
([ ! -f geoip-src.dat ] && curl -fsSL https://github.com/v2fly/geoip/releases/latest/download/geoip.dat -o geoip-src.dat) && \
mkdir -p data && \
cp ../az/result/iplist_all.txt data/ru-blocked-ips-all && \
cp ../az/result/iplist_blockedbyip.txt data/ru-blocked-ips-directblock && \
cp ../az/result/iplist_blockedbyip_noid2971.txt data/ru-blocked-ips-noid2971 && \
go run ./ && \
mv output/dat/geoip.dat ../result/ && \
cd ../..
[ ! -d .temp/geosite ] && \
git clone --depth=1 https://github.com/v2fly/domain-list-community.git .temp/geosite && \
cd .temp/geosite && \
cp ../az/result/hostlist_zones.txt data/category-ru-blocked-zones && \
cp ../az/result/hostlist_original.txt data/category-ru-blocked-domains && \
go run ./ --outputdir=../result --outputname=geosite.dat

1
geoip

@ -1 +0,0 @@
Subproject commit 3182dda7b38c900f28505b91a44b09ec486e6f36

12
tag.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
set -eux
export VERSION=`date +%Y%m%d%H%M%S`
curl -X 'POST' \
'https://gitea.neur0tx.site/api/v1/repos/xray-addons/geoip-geosite-with-ru-blocklist/tags?token='"$GITEA_API_KEY"'' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"message": "'"$VERSION"': daily release from ci",
"tag_name": "'"$VERSION"'",
"target": "master"
}'