refactor(ci): 合并知识库发布流程并支持多包发布

- 删除了单独的 publish-knowledge.yml 工作流
- 在 publish.yml 中添加 package 输入以支持多包发布
- 根据 package 选择性传递 --knowledge 标志给发布脚本
- 更新并重命名发布任务以反映 package 区别
- 修改并扩展并发组以包含 package 维度
- 注释更新,说明 knowledge-studio-cli 通过主工作流发布并共享依赖
This commit is contained in:
zeyu.fz
2026-06-26 18:01:58 +08:00
parent a966b4077f
commit 780ca6addb
3 changed files with 13 additions and 92 deletions
-86
View File
@@ -1,86 +0,0 @@
name: Publish Knowledge
on:
workflow_dispatch:
inputs:
mode:
description: "Publish mode"
required: true
type: choice
options:
- channel
- stable
channel:
description: "dist-tag (channel mode only, e.g. mcp/plugin/advisor)"
required: false
type: string
concurrency:
group: publish-knowledge-${{ inputs.mode }}-${{ inputs.channel }}
cancel-in-progress: false
jobs:
publish-stable:
if: inputs.mode == 'stable'
name: publish stable (with knowledge) to npm + tag
runs-on: ubuntu-latest
environment: production # Required Reviewers gate
permissions:
contents: write # push lightweight tag to origin
id-token: write # OIDC for npm Trusted Publishing + provenance
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: "24"
cache: pnpm
registry-url: "https://registry.npmjs.org/"
- name: Install gitleaks
run: |
set -euo pipefail
GITLEAKS_VERSION=8.21.2
curl -sSfL \
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
| sudo tar -xz -C /usr/local/bin gitleaks
gitleaks version
- run: pnpm install --frozen-lockfile
- name: publish-stable (with knowledge)
run: node tools/release/publish-stable.mjs --knowledge
publish-channel:
if: inputs.mode == 'channel'
name: publish beta (with knowledge) to npm
runs-on: ubuntu-latest
permissions:
contents: read # no tag, no Release; just publish
id-token: write # OIDC for npm Trusted Publishing + provenance
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: "24"
cache: pnpm
registry-url: "https://registry.npmjs.org/"
- name: Install gitleaks
run: |
set -euo pipefail
GITLEAKS_VERSION=8.21.2
curl -sSfL \
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz" \
| sudo tar -xz -C /usr/local/bin gitleaks
gitleaks version
- run: pnpm install --frozen-lockfile
- name: publish-channel (with knowledge)
run: node tools/release/publish-channel.mjs --knowledge --channel "${{ inputs.channel }}"
+12 -5
View File
@@ -3,6 +3,13 @@ name: Publish
on:
workflow_dispatch:
inputs:
package:
description: "Which package set to publish"
required: true
type: choice
options:
- bailian-cli
- knowledge-studio-cli
mode:
description: "Publish mode"
required: true
@@ -16,13 +23,13 @@ on:
type: string
concurrency:
group: publish-${{ inputs.mode }}-${{ inputs.channel }}
group: publish-${{ inputs.package }}-${{ inputs.mode }}-${{ inputs.channel }}
cancel-in-progress: false
jobs:
publish-stable:
if: inputs.mode == 'stable'
name: publish stable to npm + tag
name: publish stable (${{ inputs.package }}) to npm + tag
runs-on: ubuntu-latest
environment: production # Required Reviewers gate
permissions:
@@ -51,11 +58,11 @@ jobs:
- run: pnpm install --frozen-lockfile
- name: publish-stable
run: node tools/release/publish-stable.mjs
run: node tools/release/publish-stable.mjs ${{ inputs.package == 'knowledge-studio-cli' && '--knowledge' || '' }}
publish-channel:
if: inputs.mode == 'channel'
name: publish beta to npm
name: publish channel (${{ inputs.package }}) to npm
runs-on: ubuntu-latest
permissions:
contents: read # no tag, no Release; just publish
@@ -83,4 +90,4 @@ jobs:
- run: pnpm install --frozen-lockfile
- name: publish-channel
run: node tools/release/publish-channel.mjs --channel "${{ inputs.channel }}"
run: node tools/release/publish-channel.mjs ${{ inputs.package == 'knowledge-studio-cli' && '--knowledge' || '' }} --channel "${{ inputs.channel }}"
+1 -1
View File
@@ -10,7 +10,7 @@ export const PACKAGES = [
];
// knowledge-studio-cli shares the same library deps as bailian-cli.
// Published via a separate workflow (publish-knowledge.yml) with --knowledge flag.
// Published via publish.yml with package=knowledge-studio-cli (passes --knowledge flag).
export const KSCLI_PACKAGE = { key: "kscli", dir: "packages/kscli", name: "knowledge-studio-cli" };
export const ALL_PACKAGES = [...PACKAGES, KSCLI_PACKAGE];