改用 netlify build

This commit is contained in:
tasi788 2022-09-03 14:00:16 +08:00
parent ccb4e24b96
commit 5690e32096
8 changed files with 57 additions and 122 deletions

View File

@ -1,61 +0,0 @@
name: Auto Update Version
on:
push:
paths:
- "**.txt"
- "AutoBuild/pure_domain.py"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }} # Checkout the correct branch name
fetch-depth: 0 # Fetch the whole repo history
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Set up Git config
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
OLD_MSG=$(git log --format=%B -n1)
- id: files
uses: jitterbit/get-changed-files@v1
with:
format: "csv"
- name: Run AutoUpdateVerNum
run: |
cd ${{ github.workspace }}/AutoBuild
mapfile -d ',' -t added_modified_files < <(printf '%s,' '${{ steps.files.outputs.added_modified }}')
for added_modified_file in "${added_modified_files[@]}"; do
python auto_update_version.py ${added_modified_file}
done
- name: Commit files modified by "AutoUpdateVerNum" step
run: |
git commit --amend -a -m "🤖 自動更新 版本號" -m"$OLD_MSG" || echo "[INFO] Fail to update version number, may not need to update at all?"
- name: Run AutoBuild
run: |
cd ${{ github.workspace }}/AutoBuild
python pure_domain.py
- name: Commit files modified by "AutoBuild" step
run: |
git commit --amend -a -m "🤖 自動更新 domains.txt" -m"$OLD_MSG" || echo "[INFO] Fail to commit domains.txt, may not need to update the file?"
- name: Push changes
uses: ad-m/github-push-action@master
with:
force: true
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}

View File

@ -1,36 +0,0 @@
name: Hide_FarmContent_From_Search
on:
workflow_dispatch:
push:
paths:
- "nofarm_hosts.txt"
- "AutoBuild/hide_farm.py"
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Run AutoBuild
run: |
cd AutoBuild
python hide_farm.py
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add hide_farm_from_search.txt
git commit -m "🤖 自動更新 NoFarm"
- name: Push changes
uses: ad-m/github-push-action@master

55
AutoBuild/builder.py Normal file
View File

@ -0,0 +1,55 @@
import requests
import re
from datetime import datetime, timedelta, timezone
filterlist = {
'abp': ['experimental.txt', 'filter.txt'],
'hosts': ['hosts.txt', 'nofarm_hosts.txt']
}
url = 'https://filter.futa.gg/'
tz = timezone(timedelta(hours=+8))
today = datetime.now(tz).date()
class HEAD:
abp: str = '[Adblock Plus]\n' \
'! Title: LowTechFilter {name}\n' \
'! Version: {version}\n' \
'! Expires: 1 hour\n' \
'! Homepage: https://t.me/adguard_tw\n' \
'! ----------------------------------------------------------------------\n'
hosts: str = '! FutaHosts\n' \
'! LowTechFilter {name}\n' \
'! URL: <https://github.com/FutaGuard/LowTechFilter>\n' \
'! Version: {version}\n' \
'! --------------------------------------------------\n'
for category in filterlist:
for filename in filterlist[category]:
r = requests.get(url+filename)
if r.status_code != 200:
break
pattern = r'(?<=Version: )(\d+\.\d+\.)(\d+)'
first = '\n'.join(r.text.splitlines()[:5])
version = None
try:
version = re.findall(pattern, first, re.MULTILINE)[0]
except IndexError:
# https://www.ptt.cc/bbs/Battlegirlhs/M.1506615677.A.1A4.html
version = ('2017.0929.', '1')
dt = datetime.strptime(version[0], '%Y.%m%d.').date()
newversion = today.strftime('%Y.%m%d.')
if dt != today:
newversion += '1'
else:
newversion += str(int(version[1]) + 1)
with open(f'../{filename}', 'r') as files:
with open(f'../{filename}', 'w') as output:
heads: str = HEAD().__getattribute__(category)
news = heads.format(
name=filename.split('.')[0].replace('_', ' ').title(),
version=newversion
)
output.write(news+files.read())

View File

@ -1,8 +1,3 @@
# FutaHosts
# LowTechFilter Host
# URL: <https://github.com/FutaGuard/LowTechFilter>
# Version: 2022.0902.1
# --------------------------------------------------
5hz.org
awetd.club
sexsa.xyz

View File

@ -1,11 +1,4 @@
[Adblock Plus]
! Title: LowTechFilter Experimental
! Version: 2022.0728.01
! Expires: 1 hour
! Homepage: https://t.me/adguard_tw
! ----------------------------------------------------------------------
!
! === 此為實驗性過濾清單 ===
! === 此為實驗性過濾清單 ===
! === THIS IS AN EXPERIMENTAL FILTER ===
!
! Shopee.tw

View File

@ -1,9 +1,3 @@
[Adblock Plus]
! Title: LowTechFilter
! Version: 2022.0902.1
! Expires: 1 hour
! Homepage: https://t.me/adguard_tw
! ----------------------------------------------------------------------
! PTT 驗證
! www.ptt.cc#%#document.onreadystatechange=()=>{if(location.pathname.includes('/ask/over18')){document.querySelectorAll('.over18-button-container>button[name="yes"]').forEach(x=>x.click())}};
! ----------------------------------------------------------------------

View File

@ -1,8 +1,3 @@
! FutaHosts
! LowTechFilter Host
! URL: <https://github.com/FutaGuard/LowTechFilter>
! Version: 2022.0902.1
! --------------------------------------------------
! 白清單
@@||ip2location.com^
@@||fonts.gstatic.com^

View File

@ -1,7 +1,7 @@
! LowTechHost
! LowTechFilter nofarm
! URL: <https://github.com/FutaGuard/LowTechFilter>
! 2021.0916.01
! Version: 2021.0916.01
! --------------------------------------------------
||366service.com^
||7box.vip^