从 SDK 接入到版本发布的完整操作手册与接口参考
统一发布管理平台提供完整的客户端软件版本发布与在线更新管理能力,支持:
npm install /path/to/release_platform/sdk
在项目根目录创建 sdk.config.js:
module.exports = {
projectId: 'your_project_id',
apiKey: 'your_api_key_from_platform',
platformUrl: 'https://release-platform.cdyunxi.cn',
buildDir: 'dist',
platforms: 'windows',
arch: 'x64',
};
npx platform-publish --version=1.2.0
配置文件支持三种命名:sdk.config.js、.publishrc.js、publish.config.js
module.exports = {
// 必填:项目 ID(在平台创建项目后获得)
projectId: 'self_print',
// 必填:API 密钥(在平台项目详情中获取)
apiKey: 'your-api-key',
// 平台地址
platformUrl: 'https://release-platform.cdyunxi.cn',
// 构建产物目录
buildDir: 'dist',
// 目标平台
platforms: 'windows',
// 目标架构
arch: 'x64',
// 预构建命令(可选)
prebuild: 'npm run build',
// 多包配置(可选)
packages: {
asar: {
enabled: true,
type: 'asar',
buildDir: 'dist',
include: ['**/*'],
exclude: ['*.exe', '*.node', '*.dll'],
},
cold: {
enabled: true,
type: 'cold',
buildDir: 'release',
include: ['*.exe'],
},
},
};
PLATFORM_URL=https://release-platform.cdyunxi.cn
PLATFORM_PROJECT_ID=your_project_id
PLATFORM_API_KEY=your_api_key
| 选项 | 说明 |
|---|---|
--version=x.x.x |
指定版本号(默认从 package.json 读取) |
--dry-run |
模拟运行,不实际上传发布 |
--no-confirm |
发布草稿但不自动确认 |
--force |
标记为强制更新 |
适用于主程序、原生模块、依赖变更等场景,需要重启。
适用于业务代码、资源文件变更等场景,需要重启。
基础地址:https://release-platform.cdyunxi.cn
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /api/platform/update/check |
检查更新 |
| GET | /api/platform/update/latest-manifest |
获取最新版本清单 |
| POST | /api/platform/update/report |
上报更新结果 |
GET /api/platform/update/check
?project_id=self_print
¤t_version=1.0.0
&device_unique_id=xxx
&store_id=0
// 响应示例
{
"code": 200,
"data": {
"hasUpdate": true,
"manifest": {
"version": "1.2.0",
"releaseNotes": "更新日志...",
"forceUpdate": false,
"updateType": "asar",
"needRestart": true,
"url": "https://.../self_print-1.2.0-asar-patch.zip",
"fileName": "self_print-1.2.0-asar-patch.zip"
}
}
}
| 方法 | 路径 | 说明 |
|---|---|---|
| GET | /api/platform/projects |
项目列表 |
| POST | /api/platform/projects |
创建项目 |
| GET | /api/platform/update/versions |
版本列表 |
| POST | /api/platform/update/publish |
发布版本(草稿) |
| POST | /api/platform/update/confirm |
确认发布 |
| POST | /api/platform/update/offline |
版本下线 |
| POST | /api/platform/update/upload |
上传更新包 |
| PUT | /api/platform/update/gray-config |
更新灰度配置 |
| GET | /api/platform/update/logs |
更新日志 |
| GET | /api/platform/terminal/dashboard |
终端监控 |
feat:、fix:),
按类型分组生成更新日志。请确保提交信息遵循
Conventional Commits 规范。