-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (66 loc) · 3.39 KB
/
Main.yml
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Main
on:
schedule:
- cron: "10 22 * * *"
workflow_dispatch:
jobs:
update-rules:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# - name: Install Mihomo
# env:
# DEBIAN_FRONTEND: noninteractive
# run: |
# case "$(uname -m)" in
# 'x86_64') ARCH='amd64' ;;
# 'x86'|'i686'|'i386') ARCH='386' ;;
# 'aarch64'|'arm64') ARCH='arm64' ;;
# 'armv7l') ARCH='armv7' ;;
# 'riscv64') ARCH='riscv64';;
# 's390x') ARCH='s390x' ;;
# *) ARCH='unknown';;
# esac
# echo "Detected architecture: $ARCH"
# if [ "$ARCH" != 'unknown' ]; then
# MIHOMO_VER=$(wget -qO- 'https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha/version.txt')
# MIHOMO_URL="https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha/mihomo-linux-${ARCH}-${MIHOMO_VER}.deb"
# wget -qO mihomo.deb "$MIHOMO_URL"
# sudo apt-get install ./mihomo.deb
# else
# echo "Fail due to unsupported mihomo architecture"
# exit 1
# fi
# - name: Download domains file for anti-AD-EDNS
# run: curl -o anti-AD-EDNS.domains https://raw.githubusercontent.com/privacy-protection-tools/anti-AD/refs/heads/master/discretion/dns.txt
# - name: Convert hosts to Mihomo rules yaml (Domain) for anti-AD-EDNS
# run: python3 Source/Script/DomainsToYAML.py anti-AD-EDNS.domains anti-AD-EDNS.yaml
# - name: Combine Mihomo rules yaml (Domain) With IP for anti-AD-EDNS
# run: python3 Source/Script/YAMLCombineIP.py anti-AD-EDNS.yaml anti-AD-EDNS.yaml
- name: Download hosts file for StevenBlack
run: curl -o StevenBlack.hosts https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
- name: Convert hosts to Mihomo rules yaml for StevenBlack
run: python3 Source/Script/HostsToYAML.py StevenBlack.hosts StevenBlack.yaml
# - name: Compile to Mihomo rules binary for StevenBlack
# run: mihomo convert-ruleset domain yaml StevenBlack.yaml StevenBlack.mrs
- name: Download hosts file for Fuck-You-MIUI-Fhosts
run: curl -o Fuck-You-MIUI-Fhosts.hosts https://raw.githubusercontent.com/LoopDns/Fuck-you-MIUI/refs/heads/main/Fhosts
- name: Convert hosts to Mihomo rules yaml for Fuck-You-MIUI-Fhosts
run: python3 Source/Script/HostsToYAML.py Fuck-You-MIUI-Fhosts.hosts Fuck-You-MIUI-Fhosts.yaml
- name: Download hosts file for Fuck-You-MIUI-MIhosts
run: curl -o Fuck-You-MIUI-MIhosts.hosts https://raw.githubusercontent.com/LoopDns/Fuck-you-MIUI/refs/heads/main/MIhosts
- name: Convert hosts to Mihomo rules yaml for Fuck-You-MIUI-MIhosts
run: python3 Source/Script/HostsToYAML.py Fuck-You-MIUI-MIhosts.hosts Fuck-You-MIUI-MIhosts.yaml
- name: Push to releases branch
run: |
current_date=$(date +'%Y-%m-%d')
rm -rf .git/*
git init
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}"
git checkout -b release
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git add *.yaml
git commit -m "Update rules ($current_date)"
git push origin release -f