Skip to content

Feat: support to specify IP or CIDR in config file for text input format #297

Feat: support to specify IP or CIDR in config file for text input format

Feat: support to specify IP or CIDR in config file for text input format #297

Workflow file for this run

name: Build geoip.dat
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 4"
push:
branches:
- master
paths-ignore:
- "README.md"
- ".gitignore"
- "LICENSE"
- "**/dependabot.yml"
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 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: Get GeoLite2
env:
LICENSE_KEY: ${{ secrets.MAXMIND_LICEHSE }}
run: |
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o GeoLite2-Country-CSV.zip
unzip GeoLite2-Country-CSV.zip
rm -f GeoLite2-Country-CSV.zip
mv GeoLite2* geolite2
- name: Build geoip.dat
run: |
go run ./
- name: Generate sha256 checksum for dat files
run: |
cd ./output || exit 1
for name in $(ls *.dat); 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 geoip release
- name: Release and upload assets
run: |
gh release create ${{ env.TAG_NAME }} -t ${{ env.RELEASE_NAME }} \
./output/geoip.dat \
./output/geoip.dat.sha256sum \
./output/geoip-only-cn-private.dat \
./output/geoip-only-cn-private.dat.sha256sum \
./output/cn.dat \
./output/cn.dat.sha256sum \
./output/private.dat \
./output/private.dat.sha256sum
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}