-
Notifications
You must be signed in to change notification settings - Fork 649
97 lines (85 loc) · 3.14 KB
/
auto-release.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
name: 🚀 Auto Release
on:
push:
branches:
- master
jobs:
release:
runs-on: macos-latest
if: startsWith(github.event.head_commit.message , 'chore(release):')
steps:
- uses: actions/checkout@v3
with:
fetch-depth: "0"
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
# 发布开始通知
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
- name: Release start notify
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }}
ignoreError: true
body: |
{
"msgtype": "link",
"link": {
"title": "🚀 F2 开始发布",
"text": "🔗 查看详情",
"messageUrl": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"picUrl": "https://gw.alipayobjects.com/zos/finxbff/compress-tinypng/ea88c724-38fb-42aa-8055-0e08155368b9.png"
}
}
- name: Install dependencies
run: yarn
- name: lint
run: |
npm run lint
- name: build
run: |
npm run build
env:
CI: false
- name: test
run: |
npm run test
- name: Prepare
# https://github.com/lerna/lerna/issues/2404
# https://github.com/lerna/lerna/issues/2788
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run release
# 发布失败通知内部开发群
- name: Release failed notify
if: ${{ failure() }}
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }}
ignoreError: true
body: |
{
"msgtype": "link",
"link": {
"title": "😳😳😳 F2 发布失败",
"text": "🔗 请点击链接查看具体原因, 及时修复, 尝试点击右上角 [Re-run all jobs] 重试, 或手动发布",
"messageUrl": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"picUrl": "https://gw.alipayobjects.com/zos/finxbff/compress-tinypng/ea88c724-38fb-42aa-8055-0e08155368b9.png"
}
}
- name: Release success notify
if: ${{ success() }}
uses: visiky/dingtalk-release-notify@main
with:
DING_TALK_TOKEN: ${{ secrets.DING_TALK_ACCESS_TOKEN }}
notify_title: '🎉 F2 新版本发布啦 🎉'
notify_body: '## { title } <hr /> ![preview](https://gw.alipayobjects.com/zos/finxbff/compress-tinypng/c833f8c9-c629-4943-a09b-ce1bf17ca937.png) <hr /> { body } <hr />'
notify_footer: '> 前往 [**AntV/F2 Releases**]({ release_url })查看完整更新日志.'
at_all: false
enable_prerelease: false