-
Notifications
You must be signed in to change notification settings - Fork 4
64 lines (55 loc) · 2.14 KB
/
run.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Build and Convert Filters
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip
python3 -m pip install requests
- name: Get Latest Sing-box Release
id: get_latest_release
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const result = await github.rest.repos.getLatestRelease({
owner: 'SagerNet',
repo: 'sing-box',
});
return result.data.tag_name;
- name: Download and Extract Sing-box
run: |
VERSION=${{ steps.get_latest_release.outputs.result }}
VERSION_NUMBER="${VERSION:1}"
SING_BOX_DIR="./sing-box-${VERSION_NUMBER}-linux-amd64"
wget -O sing-box.tar.gz https://github.com/SagerNet/sing-box/releases/download/${VERSION}/sing-box-${VERSION_NUMBER}-linux-amd64.tar.gz || exit 1
tar -xzvf sing-box.tar.gz || exit 1
chmod +x "${SING_BOX_DIR}/sing-box"
- name: Run Python Script
run: python3 run.py
- name: Convert Using Sing-box
run: |
VERSION=${{ steps.get_latest_release.outputs.result }}
VERSION_NUMBER="${VERSION:1}"
SING_BOX_DIR="./sing-box-${VERSION_NUMBER}-linux-amd64"
"${SING_BOX_DIR}/sing-box" rule-set convert --type adguard --output geosite-dnsblock.srs ./temp_filters.txt
- name: Commit geosite-dnsblock.srs to Root Directory
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add geosite-dnsblock.srs
git commit -m "Update geosite-dnsblock.srs (using ${{ steps.get_latest_release.outputs.result }})" || echo "No changes to commit"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}