Compare commits

...

5 Commits

Author SHA1 Message Date
7db6bdaf3d fix for Makefile
Some checks failed
continuous-integration/drone/push Build is failing
2023-11-16 12:19:47 +03:00
bc7e16c009 fix for Makefile 2023-11-16 12:19:27 +03:00
d8e8e891dc use Makefile 2023-11-16 12:19:06 +03:00
ef10f37224 fix for build script 2023-11-16 11:51:11 +03:00
215e4d554d add used projects as submodules 2023-11-16 11:45:15 +03:00
9 changed files with 72 additions and 46 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 curl grep libidn sipcalc gawk git patch bash python3 - apk add --no-cache make curl grep libidn sipcalc gawk git patch bash python3
- bash generate.sh - make all
- 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 curl - apk add --no-cache make curl
- sh tag.sh - make release
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: .temp/result/* files: .build/*
checksum: checksum:
- sha256 - sha256
when: when:

2
.gitignore vendored
View File

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

9
.gitmodules vendored Normal file
View File

@ -0,0 +1,9 @@
[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

54
Makefile Normal file
View File

@ -0,0 +1,54 @@
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"}'

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

1
domain-list-community Submodule

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

View File

@ -1,28 +0,0 @@
#!/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 Submodule

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

12
tag.sh
View File

@ -1,12 +0,0 @@
#!/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"
}'