-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (46 loc) · 1.67 KB
/
update.yml
File metadata and controls
56 lines (46 loc) · 1.67 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
name: Update Subscriptions
on:
push:
branches: [dev]
schedule:
- cron: '17 * * * *'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm ci
- name: Fetch and merge sources
run: npx tsx src/fetch.ts
- name: Download mihomo kernel
run: |
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/MetaCubeX/mihomo/releases | \
node -e "
const data = require('fs').readFileSync('/dev/stdin','utf8');
const releases = JSON.parse(data).filter(r => !r.prerelease && !/alpha|beta/i.test(r.tag_name));
const asset = releases[0].assets.find(a => a.name.startsWith('mihomo-linux-amd64') && a.name.endsWith('.gz') && !a.name.includes('-go'));
console.log(asset.browser_download_url);
")
curl -L "$DOWNLOAD_URL" -o mihomo.gz
gzip -dc mihomo.gz > mihomo
chmod +x mihomo
- name: Protocol handshake check
run: npx tsx src/check.ts
- name: Generate output
run: npx tsx src/output.ts
- name: Deploy to main branch
run: |
cd output
git init
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "$(date -u '+%Y-%m-%d %H:%M') update"
git push --force "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" HEAD:main