Files
agent-profiles/suites-help/开发者指南/套件发布指南.md
T

64 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 套件发布指南
## 前置条件
- 一个 API Key(从 https://auth.mercator.cn 获取)
- 套件目录包含 `workflow.yaml``scripts/`
## 一、使用 CLI 发布(推荐)
```bash
# 安装 CLI
# gis-actions 安装后自带 agc 命令(见 TOOLS.md
# 配置 API Key
agc config set api-key mk_xxxxxxxxxxxxx
# 发布
agc publish ./my-suite
```
## 二、手动发布
### 1. 打包
```bash
cd my-suite
tar czf scripts.tar.gz workflow.yaml scripts/
```
### 2. 上传到包存储
```bash
curl -X PUT \
-H "Authorization: Bearer mk_xxxx" \
-F "file=@scripts.tar.gz" \
https://suites.mercator.cn/api/v1/publish/upload
```
### 3. 注册套件
```bash
curl -X POST https://suites.mercator.cn/api/v1/suites \
-H "Authorization: Bearer mk_xxxx" \
-H "Content-Type: application/json" \
-d '{
"name": "my-suite",
"description": "我的套件",
"version": "1.0.0",
"workflow": { ... },
"package_url": "https://..."
}'
```
## 合规检测
发布时自动检测:
- `workflow.yaml` 格式是否正确
- 参数声明是否完整
- 脚本文件是否存在
- 参数类型是否匹配
不通过则发布失败,返回具体错误信息。