Skip to content

Daily Update IP database #577

Daily Update IP database

Daily Update IP database #577

Workflow file for this run

name: Daily Update IP database
on:
push:
branches:
- main
schedule:
- cron: '0 12 * * *'
env:
innoextract_version: 1.9
arch: amd64
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install requests
pip install bs4
- name: Update qqwry.dat
continue-on-error: true
shell: pwsh
run: |
python qqwry.py
unzip *.zip setup.exe
chmod +x innoextract
./innoextract setup.exe -I qqwry.dat
mv app/qqwry.dat qqwry/qqwry.dat
rm -rf setup.exe
rm -rf *.zip*
rm -rf app/
- name: Update GeoLite2-ASN
continue-on-error: true
run: wget --timeout=30 --tries=3 https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-ASN.mmdb -O geolite/GeoLite2-ASN.mmdb
- name: Update GeoLite2-City
continue-on-error: true
run: wget --timeout=30 --tries=3 https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb -O geolite/GeoLite2-City.mmdb
- name: Update GeoLite2-Country
continue-on-error: true
run: wget --timeout=30 --tries=3 https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-Country.mmdb -O geolite/GeoLite2-Country.mmdb
- name: Update ip2region
continue-on-error: true
run: |
wget --timeout=30 --tries=3 https://github.com/lionsoul2014/ip2region/raw/master/data/ip2region_v4.xdb -O ip2region/ip2region.xdb
# wget https://github.com/lionsoul2014/ip2region/raw/master/data/ip.merge.txt -O ip2region/ip.merge.txt
- name: Update 17monipdb
continue-on-error: true
run: wget --timeout=30 --tries=3 https://github.com/igreedy/ip_finder/raw/master/17monipdb.dat -O 17monipdb/17monipdb.dat
- name: Update IPDB
continue-on-error: true
run: wget --timeout=30 --tries=3 https://raw.githubusercontent.com/ipipdotnet/ipdb-go/master/city.free.ipdb -O ipdb/city.free.ipdb
- name: Update DB-IP City
continue-on-error: true
run: wget --timeout=30 --tries=3 "https://github.com/sapics/ip-location-db/raw/refs/heads/main/dbip-city-mmdb/dbip-city-ipv4.mmdb" -O db-ip/dbip-city-lite.mmdb
- name: Update DB-IP ASN
continue-on-error: true
run: wget --timeout=30 --tries=3 "https://cdn.jsdelivr.net/npm/@ip-location-db/dbip-asn-mmdb/dbip-asn-ipv4.mmdb" -O db-ip/dbip-asn-lite.mmdb
- name: Update DB-IP Country
continue-on-error: true
run: wget --timeout=30 --tries=3 "https://cdn.jsdelivr.net/npm/@ip-location-db/dbip-country-mmdb/dbip-country-ipv4.mmdb" -O db-ip/dbip-country-lite.mmdb
- name: Commit and Push changes
run: |
echo $(date +'%Y%m%d') > date.txt
git config --local user.email "[email protected]"
git config --local user.name "adysec"
git add .
# 检查是否有变更,即使部分下载失败也提交成功的更新
if git diff --cached --quiet; then
echo "No changes detected, skipping commit"
else
git commit -am "$(date +'%Y%m%d')"
# 推送变更,失败时重试
for i in {1..3}; do
if git push -v --progress; then
echo "Push successful on attempt $i"
break
else
echo "Push failed on attempt $i, retrying..."
sleep 5
fi
done
fi