Skip to content

Generate and Update AdAway/Torrents/OISD Lists #275

Generate and Update AdAway/Torrents/OISD Lists

Generate and Update AdAway/Torrents/OISD Lists #275

name: Generate and Update AdAway/Torrents/OISD Lists
on:
schedule:
- cron: '0 */72 * * *' # Every three days
workflow_dispatch:
permissions:
contents: write
jobs:
generate_lists:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Pull Changes
run: git pull
- name: Set up Node.js (if required)
uses: actions/setup-node@v4
with:
node-version: '20' # Adjust if needed
- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y curl wget git
- name: Download and Extract generate-geoip-geosite
run: |
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/Dunamis4tw/generate-geoip-geosite/releases/latest | grep "generate-geoip-geosite.*linux-amd64.tar.gz" | grep "browser_download_url" | cut -d '"' -f 4)
ARCHIVE_NAME=${DOWNLOAD_URL##*/}
wget "$DOWNLOAD_URL"
tar -xf "$ARCHIVE_NAME"
rm "$ARCHIVE_NAME"
chmod +x generate-geoip-geosite
- name: Создание временных файлов
run: |
cat << EOF > adaway_alive_hosts_mail_fb.json
[
{
"url": "https://schakal.ru/hosts/alive_hosts_mail_fb.txt",
"contentType": "HostsFile",
"category": "adaway_alive_hosts_mail_fb"
}
]
EOF
cat << EOF > torrents.json
[
{
"url": "https://raw.githubusercontent.com/im-sm/Pi-hole-Torrent-Blocklist/main/all-torrent-trackres.txt",
"contentType": "DefaultList",
"category": "torrent_trackres"
},
{
"url": "https://raw.githubusercontent.com/im-sm/Pi-hole-Torrent-Blocklist/main/all-torrent-websites.txt",
"contentType": "DefaultList",
"category": "torrent_websites"
}
]
EOF
cat << EOF > antifilter.json
[
{
"url": "https://antifilter.download/list/allyouneed.lst",
"contentType": "DefaultList",
"category": "antifilter_allyouneed"
}
]
EOF
cat << EOF > antifilter_community.json
[
{
"url": "https://community.antifilter.download/list/domains.lst",
"contentType": "DefaultList",
"category": "antifilter_community"
}
]
EOF
cat << EOF > oisd.json
[
{
"url": "https://small.oisd.nl/domainswild2",
"contentType": "DefaultList",
"category": "oisd_small"
},
{
"url": "https://big.oisd.nl/domainswild2",
"contentType": "DefaultList",
"category": "oisd_big"
},
{
"url": "https://nsfw.oisd.nl/domainswild2",
"contentType": "DefaultList",
"category": "oisd_nsfw"
}
]
EOF
- name: Генерация AdAway списков
run: |
./generate-geoip-geosite -s adaway_alive_hosts_mail_fb.json -i ./adaway -o ./adaway --gen-rule-set-srs
- name: Генерация Torrents списков
run: |
./generate-geoip-geosite -s torrents.json -i ./torrents -o ./torrents --gen-rule-set-srs
- name: Генерация AntiFilter списков
run: |
./generate-geoip-geosite -s antifilter.json -i ./antifilter -o ./antifilter --gen-rule-set-srs
./generate-geoip-geosite -s antifilter_community.json -i ./antifilter -o ./antifilter --gen-rule-set-srs
- name: Генерация OISD списков
run: |
./generate-geoip-geosite -s oisd.json -i ./oisd -o ./oisd --gen-rule-set-srs
- name: Copy .srs files to repository directory
run: |
rm -f /home/runner/work/RuRulesets/RuRulesets/*.srs
rm -f /home/runner/work/RuRulesets/RuRulesets/*.json
rm -f /home/runner/work/RuRulesets/RuRulesets/generate-geoip-geosite
mv ./adaway/*.srs /home/runner/work/RuRulesets/RuRulesets
mv ./torrents/*.srs /home/runner/work/RuRulesets/RuRulesets
mv ./antifilter/*.srs /home/runner/work/RuRulesets/RuRulesets
mv ./oisd/*.srs /home/runner/work/RuRulesets/RuRulesets
- name: Get current date
id: date
run: |
echo "DATE=$(TZ=Europe/Moscow date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
- name: Commit and Push Changes
uses: EndBug/add-and-commit@v9
with:
author_name: GitHub Action
author_email: [email protected]
message: 'Update Lists ${{ env.DATE }}'
push: true
cwd: .
default_author: github_actor
fetch: --tags --force
pathspec_error_handling: ignore
github_token: ${{ secrets.RULESET_TOKEN }}