GeoIP #74
This file contains 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: GeoIP | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Download files | |
run: | | |
wget -O GeoLite2-Country-Locations-en.csv https://github.com/PrxyHunter/GeoLite2/releases/latest/download/GeoLite2-Country-Locations-en.csv | |
wget -O GeoLite2-Country-Blocks-IPv4.csv https://github.com/PrxyHunter/GeoLite2/releases/latest/download/GeoLite2-Country-Blocks-IPv4.csv | |
wget -O GeoLite2-Country-Blocks-IPv6.csv https://github.com/PrxyHunter/GeoLite2/releases/latest/download/GeoLite2-Country-Blocks-IPv6.csv | |
awk -F ',' -v filter="$(awk -F, '{if ($5 == "IR") print $1}' GeoLite2-Country-Locations-en.csv)" '$2 == filter {print $1}' GeoLite2-Country-Blocks-IPv4.csv > GeoLite2-Country-IR.txt | |
- name: Compress files into a ZIP | |
run: | | |
zip GeoLite2-Country-CSV.zip GeoLite2-Country-Locations-en.csv GeoLite2-Country-Blocks-IPv4.csv GeoLite2-Country-Blocks-IPv6.csv | |
- name: Set tag name | |
run: echo "TAG_NAME=$(date +"%Y.%m.%d")" >> $GITHUB_ENV | |
- name: Upload to Releases | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.TAG_NAME }} | |
body: ${{ env.TAG_NAME }} | |
files: | | |
GeoLite2-Country-CSV.zip | |
GeoLite2-Country-IR.txt | |
- name: Remove old Releases | |
uses: dev-drprasad/[email protected] | |
with: | |
keep_latest: 2 | |
delete_tags: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |