docs(plugin): document auto-release workflow and zh README scaffold (SDK #68)

This commit is contained in:
RockChinQ
2026-06-09 07:39:20 -04:00
parent fbd0b2ebed
commit 8326d3f313
6 changed files with 63 additions and 3 deletions
+15
View File
@@ -20,6 +20,21 @@ lbp build
<img width="600" src="/images/zh/plugin/dev/dist/github_release.png" />
## 自动创建 Release(GitHub Actions)
自 `lbp init` 创建的插件已内置一个 GitHub Actions 工作流(`.github/workflows/release.yml`),无需手动打包和上传。
将插件仓库推送到 GitHub 后,每当您修改 `manifest.yaml` 中的 `version` 字段并推送到 `main` 或 `master` 分支时,该工作流会自动:
1. 安装 `lbp` CLI 并执行 `lbp build` 打包插件;
2. 以 `v<version>` 为标签创建一个 GitHub Release,并上传生成的 `.lbpkg` 文件。
若对应版本号的 Release 已存在,则工作流会跳过,不会重复发布。您也可以在仓库的 Actions 页面手动触发(`workflow_dispatch`)。
<Info title="">
该工作流依赖仓库默认的 `GITHUB_TOKEN`,并需要 `contents: write` 权限(模板已声明)。请确保仓库的 Actions 已启用,且 `manifest.yaml` 中的 `metadata.author`、`metadata.name`、`metadata.version` 字段填写正确——Release 名称与产物文件名均由这些字段拼接而成(`<author>-<name>-<version>.lbpkg`)。
</Info>
## 安装插件
请在 LangBot 的插件管理页面,点击右上角即可选择 GitHub 安装方式。
+6 -1
View File
@@ -38,7 +38,12 @@ Plugin Runtime 会自动启动各个已安装的插件,通过 stdio 交互。
├── main.py # 插件主程序,监听插件的生命周期
├── manifest.yaml # 插件清单文件,描述插件的元信息
├── README.md # 插件说明文件,描述插件的功能和使用方法,会被展示在插件市场页面
└── requirements.txt # 插件依赖文件
├── readme
│ └── README_zh_Hans.md # 中文说明文件,用于多语言文档
├── requirements.txt # 插件依赖文件
└── .github
└── workflows
└── release.yml # GitHub Actions 工作流,推送版本号变更时自动构建并发布 Release
```
main.py 中的插件类是每个插件通用的代码,在插件被启动时会被初始化,并传入上下文信息(配置信息等)。您可在此实现插件的初始化和关闭时的逻辑。插件类会继承于`langbot_plugin.api.definition.plugin.BasePlugin`,并提供 [LangBot 全局 API](/zh/plugin/dev/apis/common)。