-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (46 loc) · 1.37 KB
/
release-please.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
name: Release and Publish
on:
push:
# 监听 main 分支的 push 事件
branches:
- main
# 赋予 release-please-action 权限
permissions:
contents: write
pull-requests: write
jobs:
# 设置 release-please 任务
release-please:
# 设置任务运行环境为 ubuntu-latest
runs-on: ubuntu-latest
steps:
# 使用 release-please-action 动作来自动创建发布 PR
- uses: google-github-actions/release-please-action@v3
id: release
with:
# 设置发布类型为 node
release-type: node
# 设置发布PR分支
default-branch: main
# 检出代码
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
# 设置 Node.js 环境
- uses: actions/setup-node@v3
with:
# 设置 Node.js 版本
node-version: 20
# 设置 npm 源
registry-url: "https://registry.npmjs.org"
if: ${{ steps.release.outputs.release_created }}
# 安装依赖
- run: npm install
if: ${{ steps.release.outputs.release_created }}
# 构建输出
- run: npm run build
if: ${{ steps.release.outputs.release_created }}
# 发布到 npm
- run: npm run pub
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created }}