Skip to content

GeoIP: Perform Maxmind GEOIP Updates #1759

GeoIP: Perform Maxmind GEOIP Updates

GeoIP: Perform Maxmind GEOIP Updates #1759

Workflow file for this run

name: "GeoIP: Perform Maxmind GEOIP Updates"
on:
schedule:
- cron: "15 3 * * *"
push:
branches:
- "main"
paths:
- '.github/workflows/geoipupdate.yml'
jobs:
update-geoip:
runs-on: ubuntu-latest
steps:
- name: "Get Latest source"
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
token: ${{ secrets.SOURCE_PUSH_TOKEN }}
- name: "Detect dotnet version"
uses: credfeto/[email protected]
- name: "Install dotnet"
uses: actions/setup-dotnet@v4
env:
GITHUB_TOKEN: ${{ secrets.SOURCE_PUSH_TOKEN }}
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: "Enable dotnet tools"
shell: bash
run: dotnet new tool-manifest
- name: "Install Changelog tool"
shell: bash
run: dotnet tool install --local Credfeto.ChangeLog.Cmd
- name: "Save MaxMind credentials"
shell: bash
run: |
{
echo AccountID ${{ secrets.MAXMIND_ACCOUNT_ID }}
echo LicenseKey ${{ secrets.MAXMIND_LICENSE_KEY }}
echo EditionIDs GeoLite2-Country
} >> GeoIP.conf
- name: "Add Maxmind PPA"
shell: bash
run: sudo add-apt-repository ppa:maxmind/ppa
- name: "Update repository cache"
shell: bash
run: sudo apt update
- name: "Install geoipupdate"
shell: bash
run: sudo apt install geoipupdate
- name: "Get latest maxmind DB"
shell: bash
run: geoipupdate --config-file GeoIP.conf --database-directory geoip
- name: "Update changelog if changes occured"
shell: bash
run: |
git diff -s --exit-code || \
dotnet changelog --remove Changed --message "GEOIP - Updated GEOIP DB from MaxMind"
git diff -s --exit-code || \
dotnet changelog --add Changed --message "GEOIP - Updated GEOIP DB from MaxMind ($(date +'%Y-%m-%d'))"
- name: "Commit changes"
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[GEOIP] - Updated GEOIP DB from MaxMind (${{ env.WHEN}})"
file_pattern: "*.mmdb CHANGELOG.md"
commit_user_name: "credfeto-geoip[bot]"
commit_user_email: "[email protected]"
commit_author: "credfeto-geoip[bot] <[email protected]>"
skip_dirty_check: false