-
Notifications
You must be signed in to change notification settings - Fork 222
100 lines (89 loc) · 3.04 KB
/
autoupdate.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Update Rules
on:
schedule:
- cron: '0 0 * * *'
push:
paths:
- 'script/*'
- 'mod/*'
workflow_dispatch:
repository_dispatch:
type:
- [Manual-Update]
jobs:
update-rules:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- uses: actions/setup-node@v2
with:
#node-version: '14'
check-latest: true
# Install hostlist-compiler
- name: Install hostlist-compiler
run: npm i -g @adguard/hostlist-compiler
- name: Update Upstream
continue-on-error: false
run: |
pip install requests
bash ./script/update-upstream.sh
tar -czvf archive.tar.gz ./tmp/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: archive.tar.gz
path: archive.tar.gz
- name: Build Rules
continue-on-error: false
run: |
bash ./script/update-content-rules.sh
bash ./script/update-dns-rules.sh
rm -f archive.tar.gz
- name: Update other rules
run: |
cd rules
rm *.txt
wget https://raw.githubusercontent.com/damengzhu/banad/main/jiekouAD.txt
cd ../
- name: Git push assets to Github
run: |
git init
git config --local user.name "actions"
git config --local user.email "[email protected]"
git checkout --orphan main
git rm -rf .github
git rm -rf script
git rm -rf *.md
git add *.{conf,txt,list,html,json,srs,mrs} rules/* mod/*
git commit -m "Update at $(TZ=UTC-8 date +"%Y-%m-%d %H:%M")"
git push -f -u origin main
- name: Git push assets to other repos
continue-on-error: true
run: |
rm -rf .git/
git init
git config --local user.name "hacamer"
git config --local user.email "[email protected]"
git remote add origin "https://cats-team:${{ secrets.GITLAB_TOKEN }}@gitlab.com/cats-team/adrules.git"
git remote set-url --add origin "https://hacamer:${{ secrets.GITEA_TOKEN }}@gitea.com/Cats-Team/AdRules.git"
git remote set-url --add origin "https://hacamer:${{ secrets.BITBUCKET_TOKEN }}@bitbucket.org/hacamer/adrules.git"
git checkout --orphan clearhistory
git add *.{conf,html,txt,json,srs,mrs,list} rules/* mod/*
git commit -am "Update at $(TZ=UTC-8 date +"%Y-%m-%d %H:%M")"
git branch -m main
git push --force --set-upstream origin main
- name: Auto Built
continue-on-error: true
run: |
curl -X POST "${{ secrets.CF_TOKEN }}"
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
retain_days: 0
keep_minimum_runs: 2