Main #291
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |