forked from Websoft9/websoft9
-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (30 loc) · 1.17 KB
/
Copy pathwebhook.yml
File metadata and controls
35 lines (30 loc) · 1.17 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
name: Release Webhook
on:
push:
branches:
- main
paths:
- "version.json"
jobs:
send_webhook:
name: Send Webhook
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Send POST request
run: |
version=$(jq -r '.version' version.json)
if [[ $version == *-* ]]; then
version=${version%%-*}
version="${version}(预发布)"
fi
changelog=$(cat changelog_latest.md | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g')
curl 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${{ secrets.WIXIN_ROBOT_KEY }}' \
-H 'Content-Type: application/json' \
-d "{
\"msgtype\": \"markdown\",
\"markdown\": {
\"content\": \"【Release 通知】\\n> 项目名称:<font color=\\\"info\\\">websoft9</font>\\n> 最新版本:<font color=\\\"comment\\\">${version}</font>\\n> 更新内容:\\n${changelog}\\n>\"
}
}"