Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/geolite-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Update GeoLite2 Database
on: ['push']
jobs:
update-geolite2-if-changed:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- shell: bash
env:
MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
#!/bin/bash
set -eo pipefail

DATE=$(date +%F_%H-%M-%S)
BRANCH_NAME=geolite2-update-$DATE
git checkout -b $BRANCH_NAME

# Pull the new IP database
curl "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${MAXMIND_LICENSE_KEY}&suffix=tar.gz" \
--output /tmp/geolite2-country.tar.gz
mkdir /tmp/dest
tar -xzf /tmp/geolite2-country.tar.gz -C /tmp/dest
mv /tmp/dest/*/GeoLite2-Country.mmdb util/ipresolver/GeoLite2-Country.mmdb

# Commit and push the changes
git config user.email "runner@redhat.com"
git config user.name "runner"
git add util/ipresolver/GeoLite2-Country.mmdb
git commit -m "Update GeoLite2 database"
git push origin $BRANCH_NAME

# Create the PR
gh pr create -B master -H $BRANCH_NAME \
--title "Update GeoLite2 database $DATE" \
--body 'Updating GeoLite2 database to latest version. PR created automatically by the Update GeoLite2 Database GitHub action.'

Binary file modified util/ipresolver/GeoLite2-Country.mmdb
Binary file not shown.