Get GeoLite2 database #190
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Get GeoLite2 database | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "20 4 * * tue,fri" | |
| env: | |
| RELEASE_NAME: $(date +%Y%m%d%H%M) | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get GeoLite2 | |
| env: | |
| LICENSE_KEY: ${{ secrets.MAXMIND_GEOLITE2_LICENSE }} | |
| run: | | |
| curl --connect-timeout 15 -sSL "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o GeoLite2-Country-CSV.zip | |
| curl --connect-timeout 15 -sSL "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-Country&license_key=${LICENSE_KEY}&suffix=tar.gz" -o GeoLite2-Country.tar.gz | |
| curl --connect-timeout 15 -sSL "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN-CSV&license_key=${LICENSE_KEY}&suffix=zip" -o GeoLite2-ASN-CSV.zip | |
| curl --connect-timeout 15 -sSL "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-ASN&license_key=${LICENSE_KEY}&suffix=tar.gz" -o GeoLite2-ASN.tar.gz | |
| unzip GeoLite2-Country-CSV.zip | |
| tar -xvzf GeoLite2-Country.tar.gz | |
| unzip GeoLite2-ASN-CSV.zip | |
| tar -xvzf GeoLite2-ASN.tar.gz | |
| mkdir geolite2 | |
| mv GeoLite2-Country-CSV_*/*.csv geolite2 | |
| mv GeoLite2-Country_*/*.mmdb geolite2 | |
| mv GeoLite2-ASN-CSV_*/*.csv geolite2 | |
| mv GeoLite2-ASN_*/*.mmdb geolite2 | |
| - name: Push assets to geolite2 branch | |
| run: | | |
| cd geolite2 || exit 1 | |
| git init | |
| git config --local user.name "github-actions[bot]" | |
| git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git checkout -b geolite2 | |
| git add . | |
| git commit -m "${{ env.RELEASE_NAME }}" | |
| git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" | |
| git push -f origin geolite2 |