-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (61 loc) · 1.59 KB
/
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
name: build
# 触发条件:在 push或合并请求 到 master 或 release开头的分支后
on:
push:
branches:
- main
- alpha
- beta
pull_request:
branches: '*'
# 任务
jobs:
quality:
# 服务器环境:最新版 Ubuntu
runs-on: ubuntu-latest
steps:
# 拉取代码
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.12.x
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
# 执行测试和打包操作
- name: Install deps
run: npm ci
- name: Lint check
run: npm run lint
# 这条命令包含了测试
- name: Unit tests
run: npm run test
release:
runs-on: ubuntu-latest
needs: [quality]
if: ${{ github.ref == 'refs/heads/main' }}
steps:
# 拉取代码
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.12.x
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
# 执行测试和打包操作
- name: Install deps
run: npm ci
# 这条命令包含了测试和上传覆盖率
- name: Coverage
run: npm run coveralls
# 打包发布
- name: Build
run: npm run build --if-present
- name: Release
run: npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ALOVA_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}