diff --git a/.github/workflows/sync-readme.yml b/.github/workflows/sync-readme.yml new file mode 100644 index 0000000..df83f80 --- /dev/null +++ b/.github/workflows/sync-readme.yml @@ -0,0 +1,47 @@ +name: Sync README + +# Regenerates the plugin overview in README.md from lithe-plugin-index.json +# after every change lands on main, so contributors and the release bot only +# edit the index. Commits made with GITHUB_TOKEN do not trigger workflows, +# so the sync commit cannot loop. +on: + push: + branches: [main] + paths: + - lithe-plugin-index.json + - scripts/render-readme.mjs + - README.md + - assets/** + workflow_dispatch: + +permissions: + contents: write + +concurrency: + group: sync-readme + cancel-in-progress: false + +jobs: + sync: + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-node@v7 + with: + node-version: 22 + + - name: Render the plugin overview + run: node scripts/render-readme.mjs + + - name: Commit when README changed + run: | + if git diff --quiet -- README.md; then + echo "README.md is already in sync." + exit 0 + fi + git config user.name "lithe-store-bot" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add README.md + git commit -m "docs(readme): 同步插件总览" + git push origin HEAD:main diff --git a/.github/workflows/track-releases.yml b/.github/workflows/track-releases.yml index 25acbc6..6d3609a 100644 --- a/.github/workflows/track-releases.yml +++ b/.github/workflows/track-releases.yml @@ -49,7 +49,6 @@ jobs: args="" if [ -n "$PLUGIN" ]; then args="--plugin $PLUGIN"; fi node scripts/track-releases.mjs lithe-plugin-index.json $args - node scripts/render-readme.mjs - name: Verify the new archives if: steps.track.outputs.added != '0' @@ -63,7 +62,7 @@ jobs: git config user.name "lithe-store-bot" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git switch -C "$BRANCH" - git add lithe-plugin-index.json README.md + git add lithe-plugin-index.json git commit -m "chore(index): track new plugin releases" -m "$SUMMARY" git push --force origin "$BRANCH" body=$(printf '自动追踪到新的插件版本:\n\n%s\n\n已校验 SHA-256 与包内 plugin.json(id、version、pluginAPIVersion、signatureRequirement)。维护者请按 docs/maintainers.md 的清单审查后合并。' "$(echo "$SUMMARY" | tr ',' '\n' | sed 's/^ */- /')") diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index fc132ca..23fabdd 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -37,9 +37,6 @@ jobs: - name: Validate index run: node scripts/validate-index.mjs lithe-plugin-index.json - - name: Check the README plugin overview - run: node scripts/render-readme.mjs --check - - name: Pick the base index id: base run: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e6d92a2..359c5be 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,7 @@ | --- | --- | | 收录自己的插件 | 读 [docs/publishing.md](docs/publishing.md),提 PR 或开“插件收录申请” issue | | 发布插件新版本 | 在自己仓库发布 Release 即可,bot 会自动开 PR(见 [发布新版本](docs/publishing.md#4-发布新版本)) | -| 修改插件信息 | 提 PR 修改 `lithe-plugin-index.json` 中自己的条目,并运行 `node scripts/render-readme.mjs` 更新 README | +| 修改插件信息 | 提 PR 修改 `lithe-plugin-index.json` 中自己的条目(含 `icon`) | | 报告有问题的插件 | 开“报告插件问题” issue;安全问题请勾选“安全问题”,维护者会优先处理 | | 改进脚本、CI 或文档 | 直接提 PR,并运行 `node --test scripts/store.test.mjs` | @@ -13,7 +13,8 @@ - 一个 PR 只改一个插件,便于审查和回退。 - `plugins` 按 `id` 字母序排列;每个插件的 `versions` 新版本在前。 - 不修改已发布版本的 `downloadURL` 与 `sha256`;不删除历史版本(撤回问题版本除外)。 -- 修改索引后运行 `node scripts/render-readme.mjs`,README 的插件总览由它生成,CI 会检查两者是否一致。 +- README 的插件总览由 `scripts/render-readme.mjs` 根据索引生成,合并到 main 后由 `Sync README` 工作流自动提交,PR 中不需要手动更新。 +- 插件图标填在条目的 `icon` 字段,指向插件仓库内固定到提交的 SVG/PNG(`raw.githubusercontent.com////…`);没有填写时 README 使用默认图标。 - 插件的 bug 与功能请求请提到插件自己的仓库,本仓库只处理收录相关事务。 第一次开发语言插件,先读[LSP 插件完整生命周期](docs/lsp-plugin-lifecycle.md), @@ -63,7 +64,7 @@ scripts/track-releases.mjs # 追踪已收录插件的新 Release 并生成 scripts/render-readme.mjs # 根据索引生成 README 的插件总览 scripts/store.test.mjs # 校验脚本的测试(fixtures 复制自 Lithe 主仓库) assets/ # README 用到的图片(无图标插件的默认图标) -.github/workflows/ # validate(PR/推送/每周)与 track-releases(每 6 小时) +.github/workflows/ # validate(PR/推送/每周)、track-releases(每 6 小时)、sync-readme(main 更新后同步 README) ``` ## 本地校验 @@ -73,5 +74,5 @@ assets/ # README 用到的图片(无图标插件的默 ```bash node --test scripts/store.test.mjs node scripts/validate-index.mjs --verify-archives -node scripts/render-readme.mjs --check +node scripts/render-readme.mjs # 本地预览 README 插件总览 ``` diff --git a/README.md b/README.md index 391107b..650fb2b 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@
-

Go Support

+

Go Support

Lithe Community · v0.1.0 · API 1

使用你自己安装的 gopls 提供 Go 补全、跳转定义和错误提示,并支持运行 main 包和 go test(整个模块、单个文件所在的包或单个测试函数)。需要先安装 Go 和 gopls(go install gola…

🏷️ 语言支持 · 💻 macOS · GitHub stars

@@ -47,7 +47,7 @@
-

Lua Support

+

Lua Support

Lithe Community · v0.3.0 · API 1

内置 lua-language-server(LuaLS)提供 Lua 补全、跳转定义和错误提示,无需另外安装;“运行当前文件”使用你自己的 lua(brew install lua)。

🏷️ 语言支持 · 💻 macOS · GitHub stars

@@ -63,7 +63,7 @@
-

PHP Support

+

PHP Support

Lithe Community · v0.1.0 · API 1

使用你自己安装的 Intelephense 提供 PHP 补全、跳转定义和错误提示,并支持运行 PHP 文件和 PHPUnit 测试。插件不内置 Intelephense(其许可证不允许再分发),请用 npm insta…

🏷️ 语言支持 · 💻 macOS · GitHub stars

@@ -86,7 +86,7 @@ ## 🤝 参与贡献 想收录自己的插件、发布新版本或报告有问题的插件,请看 [CONTRIBUTING.md](CONTRIBUTING.md)。 -上方的插件总览由 `scripts/render-readme.mjs` 根据 [`lithe-plugin-index.json`](lithe-plugin-index.json) 生成,修改索引后运行一次即可。 +上方的插件总览由 `scripts/render-readme.mjs` 根据 [`lithe-plugin-index.json`](lithe-plugin-index.json) 生成,索引合并到 main 后由 CI 自动同步。 ## 📄 许可 diff --git a/lithe-plugin-index.json b/lithe-plugin-index.json index 3a76447..be1b4b8 100644 --- a/lithe-plugin-index.json +++ b/lithe-plugin-index.json @@ -13,6 +13,7 @@ }, "tags": ["language", "go"], "license": "Apache-2.0", + "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-go/14321930779d1b441e1b7d13d2a4a741ef8f305c/io.github.lithe-idea.go-support/icons/go.svg", "versions": [ { "version": "0.1.0", @@ -86,6 +87,7 @@ }, "tags": ["language", "lua"], "license": "Apache-2.0", + "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-lua/c5f88bf94e9d5616c7770e58febc53a0d520dd50/io.github.lithe-idea.lua-support/icons/lua.svg", "versions": [ { "version": "0.3.0", @@ -173,6 +175,7 @@ }, "tags": ["language", "php"], "license": "Apache-2.0", + "icon": "https://raw.githubusercontent.com/Lithe-IDEA/lithe-plugin-php/a0b5600d2629e7acc72dda5871dbe403ce1922a9/io.github.lithe-idea.php-support/icons/php.svg", "versions": [ { "version": "0.1.0", diff --git a/scripts/render-readme.mjs b/scripts/render-readme.mjs index c9f1823..e25183c 100644 --- a/scripts/render-readme.mjs +++ b/scripts/render-readme.mjs @@ -2,6 +2,7 @@ // Renders the plugin overview in README.md from lithe-plugin-index.json, so the // cards always match what Lithe shows in its marketplace. Only the block between // the `plugins:start` / `plugins:end` markers is generated; edit the rest by hand. +// The `Sync README` workflow runs this after every change on main. // // Usage: node scripts/render-readme.mjs [--check] // --check exit 1 when README.md is out of date instead of rewriting it. diff --git a/scripts/store.test.mjs b/scripts/store.test.mjs index bda31f5..323a286 100644 --- a/scripts/store.test.mjs +++ b/scripts/store.test.mjs @@ -327,11 +327,6 @@ test("archives must hold one matching community plugin.json", () => { } }); -test("the README plugin overview matches the published index", () => { - const index = JSON.parse(readFileSync(new URL("../lithe-plugin-index.json", import.meta.url))); - const readme = readFileSync(new URL("../README.md", import.meta.url), "utf8"); - assert.equal(renderReadme(readme, index), readme, "run: node scripts/render-readme.mjs"); -}); test("the overview renders one escaped card per plugin with a default icon", () => { const entry = validEntry();