-
Notifications
You must be signed in to change notification settings - Fork 1
38 lines (33 loc) · 1.26 KB
/
crontab.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: "Update MaxMind GeoLite2 database"
on:
schedule:
- cron: "0 5 * * 2,5"
workflow_dispatch:
jobs:
build:
permissions: write-all
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Clean up
run: |
rm -rf ./dist/*/*
- name: Download
env:
BASE_URL: "https://download.maxmind.com/app/geoip_download"
LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
run: |
wget -O "GeoLite2-ASN.tar.gz" "${BASE_URL}?edition_id=GeoLite2-ASN&license_key=${LICENSE_KEY}&suffix=tar.gz"
wget -O "GeoLite2-City.tar.gz" "${BASE_URL}?edition_id=GeoLite2-City&license_key=${LICENSE_KEY}&suffix=tar.gz"
wget -O "GeoLite2-Country.tar.gz" "${BASE_URL}?edition_id=GeoLite2-Country&license_key=${LICENSE_KEY}&suffix=tar.gz"
- name: Decompress
env:
SAVE_DIR: "./dist"
run: |
tar -zxvf "GeoLite2-ASN.tar.gz" -C "${SAVE_DIR}/GeoLite2-ASN" --strip-components 1
tar -zxvf "GeoLite2-City.tar.gz" -C "${SAVE_DIR}/GeoLite2-City" --strip-components 1
tar -zxvf "GeoLite2-Country.tar.gz" -C "${SAVE_DIR}/GeoLite2-Country" --strip-components 1
- name: Push
uses: EndBug/add-and-commit@v9
with:
add: "dist"