-
Notifications
You must be signed in to change notification settings - Fork 38
138 lines (125 loc) · 4.51 KB
/
collector.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: SpeedTest and Rename
on:
push:
branches:
- master
paths:
- "./EternityBase"
- "./spd/sub_merge_base64.txt"
- "./spd/sub_merge_yaml.yml"
# workflow_dispatch:
schedule:
# - cron: '*/5 * * * *'
# 表达式生成 https://crontab.guru/
- cron: "0 0,12 * * *"
jobs:
main:
name: Gather & Speedtest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3.7.0
with:
node-version: "18.x"
- uses: bahmutov/npm-install@v1.6.0
with:
working-directory: ./utils/localserver
- uses: actions/setup-python@v4.7.0
with:
python-version: "3.11"
cache: "pip"
# setup actions has built-in caching function
# - uses: actions/cache@v3
# with:
# path: ~/.cache/pip
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-
# - uses: actions/cache@v3
# with:
# path: ~/.cache/yarn
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
# restore-keys: |
# ${{ runner.os }}-node-
- name: Set Timezone
run: sudo timedatectl set-timezone 'Asia/Tehran'
- name: Install Requirements
run: |
pip install -r ./utils/requirements.txt
- name: Running Collector
run: |
wget -O subconverter.tar.gz https://github.com/tindy2013/subconverter/releases/download/v0.7.2/subconverter_linux64.tar.gz
tar -zxvf subconverter.tar.gz -C ./
chmod +x ./subconverter/subconverter && nohup ./subconverter/subconverter >./subconverter.log 2>&1 &
node ./utils/localserver/index.js &
sleep 2
python ./utils/list_merge.py
- name: Check for Collector Changes
id: changes
run: |
git diff --quiet && echo 'No changes' || echo '::set-output name=changed::true'
- name: Commit Directory Changes
if: steps.changes.outputs.changed == 'true'
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git pull origin master
git add ./spd
git add ./utils/Country.mmdb
git add README.md
git checkout master
git commit -m "✔️ $(date '+%Y-%m-%d %H:%M:%S') Collected"
- name: Push Directory Changes
uses: ad-m/github-push-action@master
with:
branch: master
- name: Run Lite Speedtest
run: |
sleep 5
sudo sh ./utils/speedtest/speedtest2_yaml.sh
python ./utils/speedtest/output.py
- name: Check for Eternity Changes
id: changesE
run: |
git diff --quiet && echo 'No changes' || echo '::set-output name=changed::true'
- name: Commit Eternity changes
if: steps.changesE.outputs.changed == 'true'
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git pull origin master
git add EternityBase
git add Eternity
git add Eternity.txt
git add ./spd/sub_merge.txt
git add ./spd/sub_merge_base64.txt
git add LogInfo.txt
git add ./spd/splitted/*
git commit -m "✔️ $(date '+%Y-%m-%d %H:%M:%S') Tested"
- name: Push Change
uses: ad-m/github-push-action@master
with:
branch: master
- name: Run Convertor & Formatter
run: |
sleep 5
wget -O subconverter.tar.gz https://github.com/tindy2013/subconverter/releases/download/v0.7.2/subconverter_linux64.tar.gz
tar -zxvf subconverter.tar.gz -C ./
chmod +x ./subconverter/subconverter && nohup ./subconverter/subconverter >./subconverter.log 2>&1 &
python ./utils/eternity_convert.py
- name: Commit Final changes
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git pull origin master
git add Eternity.yml
git add Eternity
git add README.md
git add ./update/*
git add LogInfo.txt
git clean -f -d
git commit -m "✔️ $(date '+%Y-%m-%d %H:%M:%S') Filtered"
- name: Push Change
uses: ad-m/github-push-action@master
with:
branch: master