Skip to content

Commit

Permalink
Release: MaxMind official country and ASN type of databases
Browse files Browse the repository at this point in the history
  • Loading branch information
Loyalsoldier committed Aug 12, 2024
1 parent 73132aa commit fe92104
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,32 @@ jobs:
echo "RELEASE_NAME=$(date +%Y%m%d%H%M)" >> $GITHUB_ENV
shell: bash

- name: Get GeoLite2
- name: Download GeoLite2 databases
env:
LICENSE_KEY: ${{ secrets.MAXMIND_GEOLITE2_LICENSE }}
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
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o GeoLite2-ASN-CSV.zip
mkdir -p geolite2
mkdir -p output
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=${LICENSE_KEY}&suffix=tar.gz" -o ./output/GeoLite2-ASN.tar.gz
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o ./output/GeoLite2-ASN-CSV.zip
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${LICENSE_KEY}&suffix=tar.gz" -o ./output/GeoLite2-Country.tar.gz
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o ./output/GeoLite2-Country-CSV.zip
- name: Prepare GeoLite2 databases
run: |
cp ./output/{*.gz,*.zip} ./
unzip GeoLite2-Country-CSV.zip
unzip GeoLite2-ASN-CSV.zip
cp GeoLite2-Country-CSV_*/*.csv geolite2/
cp GeoLite2-ASN-CSV_*/*.csv geolite2/
tar -xvzf GeoLite2-Country.tar.gz
tar -xvzf GeoLite2-ASN.tar.gz
cp GeoLite2-Country_*/*.mmdb ./output/
cp GeoLite2-ASN_*/*.mmdb ./output/
cp GeoLite2-Country-CSV_*/{GeoLite2-Country-Blocks-*,GeoLite2-Country-Locations-en,GeoLite2-Country-Locations-zh-CN}.csv ./output/
cp GeoLite2-ASN-CSV_*/*.csv ./output/
mkdir -p geolite2
cp GeoLite2-Country-CSV_*/*.csv ./geolite2/
cp GeoLite2-ASN-CSV_*/*.csv ./geolite2/
- name: Build geoip files
run: |
Expand Down Expand Up @@ -72,15 +87,6 @@ jobs:
sha256sum ${name} > ./${name}.sha256sum
done
- name: Download GeoLite2
env:
LICENSE_KEY: ${{ secrets.MAXMIND_GEOLITE2_LICENSE }}
run: |
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=${LICENSE_KEY}&suffix=tar.gz" -o ./output/GeoLite2-ASN.tar.gz
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o ./output/GeoLite2-ASN-CSV.zip
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${LICENSE_KEY}&suffix=tar.gz" -o ./output/GeoLite2-Country.tar.gz
curl -L "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o ./output/GeoLite2-Country-CSV.zip
- name: Git push assets to "release" branch
run: |
cd output || exit 1
Expand All @@ -101,7 +107,11 @@ jobs:
done
- name: Remove some files to avoid publishing to GitHub release
run: rm -rf ./output/*.{gz,zip} ./output/{clash,dat,mrs,nginx,srs,surge,text}
run: |
rm -rf ./output/*.{gz,zip}
rm -rf ./output/GeoLite2-*.csv
rm -rf ./output/GeoLite2-*.mmdb
rm -rf ./output/{clash,dat,mrs,nginx,srs,surge,text}
- name: Upload files to GitHub release
uses: svenstaro/upload-release-action@v2
Expand Down

0 comments on commit fe92104

Please sign in to comment.