从 plugins.yml 解析插件名称,通过 JetBrains Marketplace API 获取最新版本并下载,再上传到 CNB Release。
plugins.yml ──fetch.sh──▶ fetch.json ──download.sh──▶ downloads/ + download.json ──upload.sh──▶ CNB Release
yq (mikefarah/yq v4+)jqcurlbashbrew install yq jq
| 文件 | 作用 |
|---|---|
plugins.yml | 输入:产品类型 + 插件显示名列表 |
fetch.sh | 调用 JetBrains API,解析 pluginId / updateId / filename,输出 fetch.json |
download.sh | 根据 fetch.json 下载插件包到 downloads/,输出 download.json |
upload.sh | 将 downloads/ 下载产物上传到 CNB Release(按文件增量:删旧→传新) |
run.sh | 一键串联 fetch → download → upload |
product: idea
plugins:
- GitHub Copilot - Your AI Pair Programmer
- .ignore
product:用于 searchSuggest API 的 product 参数(idea / pycharm / webstorm 等)plugins:插件在 Marketplace 上的显示名(用于精确匹配 searchSuggest 的 value 字段)| 变量 | 必填 | 说明 |
|---|---|---|
CNB_API_ENDPOINT | ✅ | CNB Open API 基础地址 |
CNB_TOKEN | ✅ | CNB 个人访问令牌 |
CNB_REPO_SLUG | ✅ | 目标仓库路径(owner/repo) |
TAG_NAME | ❌ | Release 标签(默认 JetBrains) |
RELEASE_NAME | ❌ | Release 名称(默认 JetBrains Plugins) |
# 完整流程
./run.sh
# 或分步执行
./fetch.sh # plugins.yml → fetch.json
./download.sh # fetch.json → downloads/*.zip + download.json
./upload.sh # download.json → CNB Release
GET /api/searchSuggest?isIDERequest=false&product={product}&term={name}GET /api/plugins/{pluginId}/updates?channel=&size=1GET /plugin/download?rel=true&updateId={updateId}fetch.json:
[
{
"name": "GitHub Copilot - Your AI Pair Programmer",
"url": "/plugin/17718-github-copilot--your-ai-pair-programmer",
"pluginId": 17718,
"updateId": 1022367,
"version": "1.8.0-243",
"filename": "github-copilot-intellij-1.8.0-243.zip",
"downloadUrl": "https://plugins.jetbrains.com/plugin/download?rel=true&updateId=1022367",
"status": "pending"
}
]
download.json(供 upload.sh 消费):
[
{
"extension": "GitHub Copilot - Your AI Pair Programmer",
"filename": "github-copilot-intellij-1.8.0-243.zip",
"localPath": "downloads/github-copilot-intellij-1.8.0-243.zip",
"version": "1.8.0-243",
"updateId": 1022367,
"status": "success"
}
]
PLUGINS_YML=custom.yml ./fetch.sh FETCH_JSON=fetch.json DOWNLOAD_JSON=download.json DOWNLOAD_DIR=downloads ./download.sh