Skip to content

GeoLite-DB-Auto-Updater #1292

GeoLite-DB-Auto-Updater

GeoLite-DB-Auto-Updater #1292

Workflow file for this run

name: GeoLite-DB-Auto-Updater
on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: 0 8 * * *
jobs:
run:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Download GeoLite.mmdb
run: |
wget -nv -O- "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=${{ secrets.LICENSE_KEY }}&suffix=tar.gz" | tar zxv
wget -nv -O- "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${{ secrets.LICENSE_KEY }}&suffix=tar.gz" | tar zxv
wget -nv -O- "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${{ secrets.LICENSE_KEY }}&suffix=tar.gz" | tar zxv
mkdir -p upload
cp -v GeoLite*/*.mmdb upload
echo "TAG_NAME=$(date +"%Y.%m.%d")" >> $GITHUB_ENV
- name: Push to "download" branch
run: |
cd upload
git init
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git checkout -b download
git add .
git commit -m "${{ env.TAG_NAME }}"
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHU_TOKEN }}@github.com/${{ github.repository }}"
git push -f origin download
- name: Upload to Releases
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHU_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
body: ${{ env.TAG_NAME }}
files: upload/*.mmdb
- name: Remove old Releases
uses: dev-drprasad/[email protected]
with:
keep_latest: 5
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHU_TOKEN }}