-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (54 loc) · 1.66 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
name: release
on:
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: googleapis/release-please-action@v4
id: release
with:
config-file: .release-please-config.json
manifest-file: .release-please-manifest.json
- name: 检出代码
uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
# 安装 pnpm
- uses: pnpm/action-setup@v2
if: ${{ steps.release.outputs.release_created }}
with:
version: 8
# 设置 Node.js 环境
- name: 设置 Node.js 环境
uses: actions/setup-node@v4
if: ${{ steps.release.outputs.release_created }}
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
# 安装依赖
- name: 安装依赖
if: ${{ steps.release.outputs.release_created }}
run: pnpm install
# 构建输出
- name: 构建输出
if: ${{ steps.release.outputs.release_created }}
run: pnpm build
# 重新安装依赖
- name: 删除所文件 重新安装依赖
if: ${{ steps.release.outputs.release_created }}
run: rm -rf pnpm-lock.yaml && pnpm install
# 发布到 npm
- name: 发布到 npm
if: ${{ steps.release.outputs.release_created }}
run: pnpm pub
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}