generated from KarinJS/karin-plugin-template-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (48 loc) · 1.74 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
47
48
name: Release and Publish # 发布和发布的工作流程名称
on:
push:
branches:
- main # 仅当推送到 main 分支时触发
permissions:
contents: write # 设置内容的权限为写
pull-requests: write # 设置拉取请求的权限为写
jobs:
release-please:
# 设置工作流程运行环境为 Ubuntu
runs-on: ubuntu-latest
steps:
# 使用 release-please-action@v3 动作
- uses: google-github-actions/release-please-action@v3
id: release
with:
# 设置发布类型为 Node.js
release-type: node
# 设置包名
package-name: karin-plugin-memz
# 设置发起PR的默认分支
default-branch: main
# 检出代码
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
# 设置 Node.js 环境
- uses: actions/setup-node@v4
with:
# 设置 Node.js 版本
node-version: 20
# 设置 npm 注册表 URL
registry-url: "https://registry.npmjs.org"
if: ${{ steps.release.outputs.release_created }}
# 添加node-karin并安装依赖
- run: npm install --save-dev node-karin && npm install
if: ${{ steps.release.outputs.release_created }}
# 编译
- run: npm run build
if: ${{ steps.release.outputs.release_created }}
# 安装jq工具 删除开发依赖
- run: sudo apt-get install jq && jq 'del(.devDependencies)' package.json > package.json.tmp && mv package.json.tmp package.json
if: ${{ steps.release.outputs.release_created }}
# 发布带npm
- run: npm run pub
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created }}