Skip to content

Download databases

Download databases #37

name: Download databases
on:
schedule:
- cron: '0 0 * * 1,5'
workflow_dispatch:
jobs:
download_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download databases
run: |
set -ex
docker pull athlon1600/maxmind-download:latest
docker run --rm -v $(pwd)/databases:/maxmind -e ACCOUNT_ID=${{ secrets.ACCOUNT_ID }} -e LICENSE_KEY=${{ secrets.LICENSE_KEY }} athlon1600/maxmind-download
- name: Push files
run: |
set -ex
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git add databases/*
git commit -m 'Add new database files' || exit 0
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Purge CDN cache
run: |
set -ex
curl -i -L "https://purge.jsdelivr.net/gh/athlon1600/maxmind-download@master/databases/GeoLite2-ASN.mmdb"
curl -i -L "https://purge.jsdelivr.net/gh/athlon1600/maxmind-download@master/databases/GeoLite2-City.mmdb"