-
Notifications
You must be signed in to change notification settings - Fork 29
92 lines (80 loc) · 3.04 KB
/
Copy pathupdate-configs.yml
File metadata and controls
92 lines (80 loc) · 3.04 KB
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
name: Update Configs
permissions: write-all
on:
schedule:
- cron: '0 */24 * * *'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 350
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true
- name: Download sing-box
run: |
SINGBOX_VERSION=$(curl -s https://api.github.com/repos/SagerNet/sing-box/releases/latest | grep '"tag_name"' | cut -d'"' -f4 | tr -d 'v')
echo "Downloading sing-box v${SINGBOX_VERSION}"
wget -q "https://github.com/SagerNet/sing-box/releases/download/v${SINGBOX_VERSION}/sing-box-${SINGBOX_VERSION}-linux-amd64.tar.gz"
tar -xzf "sing-box-${SINGBOX_VERSION}-linux-amd64.tar.gz"
cp "sing-box-${SINGBOX_VERSION}-linux-amd64/sing-box" ./sing-box
chmod +x ./sing-box
rm -rf "sing-box-${SINGBOX_VERSION}-linux-amd64"*
./sing-box version
- name: Build
run: |
export GOPROXY=https://goproxy.io,direct
go mod tidy
go build -ldflags="-s -w" -o aggregator main.go
- name: Run
run: |
ulimit -n 65535
mkdir -p logs
./aggregator
- name: Verify
run: |
echo "=== Config Output ==="
ls -lh config/
ls -lh config/protocols/ 2>/dev/null || true
ls -lh config/batches/v2ray/ 2>/dev/null || true
ls -lh config/batches/clash/ 2>/dev/null || true
ls -lh config/batches/clash_advanced/ 2>/dev/null || true
if [ -f "config/all_configs.txt" ]; then
echo "Total V2ray configs: $(wc -l < config/all_configs.txt)"
fi
if [ -f "config/clash.yaml" ]; then
CLASH_COUNT=$(grep -c ' - name:' config/clash.yaml 2>/dev/null || echo 0)
echo "Clash standard proxies: $CLASH_COUNT"
fi
if [ -f "config/clash_advanced.yaml" ]; then
ADV_COUNT=$(grep -c ' - name:' config/clash_advanced.yaml 2>/dev/null || echo 0)
echo "Clash advanced proxies: $ADV_COUNT"
fi
echo "V2ray batches: $(ls config/batches/v2ray/*.txt 2>/dev/null | wc -l)"
echo "Clash standard batches: $(ls config/batches/clash/*.yaml 2>/dev/null | wc -l)"
echo "Clash advanced batches: $(ls config/batches/clash_advanced/*.yaml 2>/dev/null | wc -l)"
echo "=== Logs ==="
ls -lh logs/ 2>/dev/null || echo "No logs directory"
if ls logs/*.log 2>/dev/null | head -1 | xargs -I{} tail -30 {}; then
true
fi
- name: Upload Validation Logs
uses: actions/upload-artifact@v4
if: always()
with:
name: validation-logs-${{ github.run_number }}
path: logs/
retention-days: 14
if-no-files-found: warn
- name: Commit and Push
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add config/ README.md
git diff --staged --quiet || git commit -m "Update configs [$(date -u '+%Y-%m-%d %H:%M UTC')]"
git push