You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
4.0 KiB
96 lines
4.0 KiB
name: "Update"
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '8 */8 * * *' # At minute 8 past every 8th hour
|
|
|
|
jobs:
|
|
updater:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Download IPs
|
|
run: |
|
|
bash google/downloader.sh
|
|
bash amazon/downloader.sh
|
|
bash microsoft/downloader.sh
|
|
bash oracle/downloader.sh
|
|
bash digitalocean/downloader.sh
|
|
bash bing/downloader.sh
|
|
bash github/downloader.sh
|
|
bash facebook/downloader.sh
|
|
bash twitter/downloader.sh
|
|
|
|
- name: Create All-In-One ranges
|
|
run: |
|
|
cat google/ipv4.txt amazon/ipv4.txt microsoft/ipv4.txt oracle/ipv4.txt digitalocean/ipv4.txt bing/ipv4.txt github/ipv4.txt facebook/ipv4.txt twitter/ipv4.txt | sort -h > all/ipv4.txt
|
|
cat google/ipv6.txt amazon/ipv6.txt microsoft/ipv6.txt digitalocean/ipv6.txt github/ipv6.txt facebook/ipv6.txt twitter/ipv6.txt | sort -h > all/ipv6.txt
|
|
|
|
- name: Set up Python 3.7
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: '3.7'
|
|
|
|
- name: Cache pip
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ~/.cache/pip
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('utils/requirements.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
${{ runner.os }}-
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install -r utils/requirements.txt
|
|
|
|
- name: Merge Ranges
|
|
run: |
|
|
set -euo pipefail
|
|
# ipv4
|
|
python utils/merge.py --source=google/ipv4.txt | sort -h > google/ipv4_merged.txt
|
|
python utils/merge.py --source=amazon/ipv4.txt | sort -h > amazon/ipv4_merged.txt
|
|
python utils/merge.py --source=microsoft/ipv4.txt | sort -h > microsoft/ipv4_merged.txt
|
|
python utils/merge.py --source=oracle/ipv4.txt | sort -h > oracle/ipv4_merged.txt
|
|
python utils/merge.py --source=digitalocean/ipv4.txt | sort -h > digitalocean/ipv4_merged.txt
|
|
python utils/merge.py --source=bing/ipv4.txt | sort -h > bing/ipv4_merged.txt
|
|
python utils/merge.py --source=github/ipv4.txt | sort -h > github/ipv4_merged.txt
|
|
python utils/merge.py --source=facebook/ipv4.txt | sort -h > facebook/ipv4_merged.txt
|
|
python utils/merge.py --source=twitter/ipv4.txt | sort -h > twitter/ipv4_merged.txt
|
|
python utils/merge.py --source=all/ipv4.txt | sort -h > all/ipv4_merged.txt
|
|
# ipv6
|
|
python utils/merge.py --source=google/ipv6.txt | sort -h > google/ipv6_merged.txt
|
|
python utils/merge.py --source=amazon/ipv6.txt | sort -h > amazon/ipv6_merged.txt
|
|
python utils/merge.py --source=microsoft/ipv6.txt | sort -h > microsoft/ipv6_merged.txt
|
|
# oracle not provide ipv6
|
|
python utils/merge.py --source=digitalocean/ipv6.txt | sort -h > digitalocean/ipv6_merged.txt
|
|
# bing not provide ipv6
|
|
python utils/merge.py --source=github/ipv6.txt | sort -h > github/ipv6_merged.txt
|
|
python utils/merge.py --source=facebook/ipv6.txt | sort -h > facebook/ipv6_merged.txt
|
|
python utils/merge.py --source=twitter/ipv6.txt | sort -h > twitter/ipv6_merged.txt
|
|
python utils/merge.py --source=all/ipv6.txt | sort -h > all/ipv6_merged.txt
|
|
|
|
- name: Commit files
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
git remote add github "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
|
git pull github ${GITHUB_REF} --ff-only
|
|
|
|
# Get name & email from 1st commit
|
|
git config --local user.email "$(git log --format='%ae' --reverse | head -1)"
|
|
git config --local user.name "$(git log --format='%an' --reverse | head -1)"
|
|
|
|
# try commit
|
|
git add .
|
|
if [ -z "$(git status --porcelain)" ]; then
|
|
echo 'No changes'
|
|
exit 0
|
|
fi
|
|
git commit -m "Auto-update ip ranges"
|
|
|
|
# push changes
|
|
git push github HEAD:${GITHUB_REF}
|
|
|