-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (65 loc) · 2.54 KB
/
main.yml
File metadata and controls
77 lines (65 loc) · 2.54 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
# ⚠️ DEPRECATED: 此文件已被 release.yml 替代
# 保留仅供参考,将在未来删除
# 请使用新的 tag 格式: project-name/v1.2.3
# 参见: docs/CI-CD-GUIDE.md
name: Build on Release (DEPRECATED)
permissions:
contents: write
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: npm install
- name: Install sub-project dependencies
working-directory: projects/switch520-auto-secret
run: npm install
- name: Build project
working-directory: projects/switch520-auto-secret
run: npm run build
- name: Create patch-notes.html from release body
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const body = context.payload.release.body || 'No release notes provided.';
fs.writeFileSync('patch-notes.html', body, 'utf8');
- name: Commit patch-notes.html to patch-notes branch
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: patch-notes
commit_message: 'chore: update patch-notes.html from release ${{ github.event.release.tag_name }}'
file_pattern: patch-notes.html
create_branch: true
- name: Upload build artifacts
uses: softprops/action-gh-release@v2
with:
files: |
projects/switch520-auto-secret/dist/**
# ==================== 关键:构建+上传全部完成后才触发 GreasyFork ====================
- name: Trigger GreasyFork Webhook
if: success()
run: |
echo "🚀 Triggering GreasyFork sync after all assets uploaded..."
curl -f -X POST \
-H "Content-Type: application/json" \
--data '{
"action": "published",
"release": {
"tag_name": "${{ github.event.release.tag_name }}",
"html_url": "${{ github.event.release.html_url }}"
}
}' \
"${{ secrets.GREASYFORK_WEBHOOK_URL }}"
echo "✅ GreasyFork webhook triggered successfully"