mirror of
https://github.com/runetfreedom/russia-blocked-geoip.git
synced 2026-05-08 14:43:20 +00:00
102 lines
2.9 KiB
YAML
102 lines
2.9 KiB
YAML
name: Build geoip files
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: "0 3,9,15,21 * * *"
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- ".gitignore"
|
|
- "LICENSE*"
|
|
- "*.md"
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout codebase
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Checkout runetfreedom/geoip
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: runetfreedom/geoip
|
|
path: geoip
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: ./geoip/go.mod
|
|
|
|
- name: Set variables
|
|
run: |
|
|
echo "TAG_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
|
echo "RELEASE_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- name: Build geoip files
|
|
run: |
|
|
go build -C geoip ./
|
|
./geoip/geoip convert -c ./config.json
|
|
|
|
- name: Verify mmdb files
|
|
run: |
|
|
cd ./output || exit 1
|
|
go install -v github.com/maxmind/mmdbverify@latest
|
|
for name in $(ls *.mmdb); do
|
|
$(go env GOPATH)/bin/mmdbverify -file ${name}
|
|
done
|
|
|
|
- name: Generate sha256 checksum for dat files
|
|
run: |
|
|
cd ./output || exit 1
|
|
for name in $(ls *.dat); do
|
|
sha256sum ${name} > ./${name}.sha256sum
|
|
done
|
|
|
|
- name: Generate sha256 checksum for mmdb files
|
|
run: |
|
|
cd ./output || exit 1
|
|
for name in $(ls *.mmdb); do
|
|
sha256sum ${name} > ./${name}.sha256sum
|
|
done
|
|
|
|
- name: Git push assets to "release" branch
|
|
run: |
|
|
cd output || exit 1
|
|
git init
|
|
git config --local user.name "github-actions[bot]"
|
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git checkout -b release
|
|
git add -A
|
|
git commit -m "${{ env.RELEASE_NAME }}"
|
|
git remote add geoip "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
|
|
git push -f -u geoip release
|
|
|
|
- name: Purge jsdelivr CDN
|
|
run: |
|
|
cd output || exit 1
|
|
for file in $(ls); do
|
|
curl -i "https://purge.jsdelivr.net/gh/${{ github.repository }}@release/${file}"
|
|
done
|
|
|
|
- name: Remove some files to avoid publishing to GitHub release
|
|
run: |
|
|
rm -rf ./output/*.{gz,zip}
|
|
rm -rf ./output/GeoLite2-*.csv
|
|
rm -rf ./output/GeoLite2-*.mmdb
|
|
rm -rf ./output/GeoLite2-*.sha256sum
|
|
rm -rf ./output/{clash,dat,mrs,nginx,srs,surge,text}
|
|
|
|
- name: Upload files to GitHub release
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
file_glob: true
|
|
file: ./output/*
|
|
release_name: ${{ env.RELEASE_NAME }}
|
|
tag: ${{ env.TAG_NAME }}
|