Skip to content

Generate RuleSet

Generate RuleSet #362

Workflow file for this run

name: Generate RuleSet
on:
schedule:
- cron: "30 1 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
generate_lists:
runs-on: ubuntu-latest
steps:
- name: Checkout codebase
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Install go and plugin
run: |
go install github.com/Loyalsoldier/geoip@latest
- name: Download CSV sources
env:
NO_SKIP: true
run: |
mkdir -p source
curl -L "https://dl.netsyms.net/dbs/geolite2/GeoLite2-ASN-CSV.zip" -o ./GeoLite.zip
curl -L "https://ipinfo.io/data/ipinfo_lite.csv.gz?token=733332abe59b9c" -o ./IpInfo.gz
curl -L "https://raw.githubusercontent.com/sapics/ip-location-db/refs/heads/main/asn/asn-ipv4.csv" -o ./asn-ipv4.csv
curl -L "https://raw.githubusercontent.com/sapics/ip-location-db/refs/heads/main/asn/asn-ipv6.csv" -o ./asn-ipv6.csv
- name: Unzip
env:
NO_SKIP: true
run: |
unzip -jo GeoLite.zip "GeoLite*/GeoLite*"
gunzip -c IpInfo.gz > ipinfo_lite.csv
rm -rf GeoLite.zip
rm -rf IpInfo.gz
- name: Extraction CIDR blocks by organization with deduplication and summarization
env:
NO_SKIP: true
run: bash cidr_extractor.sh
- name: Compile RuleSet
env:
NO_SKIP: true
run: |
geoip convert
- name: Get current date and release tag
id: date
run: |
echo "DATE=$(date -u +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
echo "TAG_NAME=build-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_ENV
git config user.email "PentiumB@users.noreply.github.com"
git config user.name "PentiumB"
git add .
git commit -m "Generate rule-sets ${{ env.DATE }}" || echo "No changes to commit"
git push
- name: Upload Release Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$TAG_NAME" release/* --title "$TAG_NAME" --notes "Automated build"