Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/plugin-marketplace-ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@moonshot-ai/kimi-code": patch
---

feat(ci): publish plugin marketplace on release

- Add `build:plugin-marketplace` step to the release workflow
- Upload plugin marketplace artifacts as GitHub Release assets
- Make `build-plugin-marketplace-cdn` script skip missing sources gracefully
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ jobs:
- name: Build packages
run: pnpm build

- name: Build plugin marketplace
run: pnpm run build:plugin-marketplace

- name: Upload plugin marketplace artifact
uses: actions/upload-artifact@v4
with:
name: plugin-marketplace
path: plugins/cdn
retention-days: 7

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
Expand Down Expand Up @@ -128,3 +138,33 @@ jobs:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ needs.release.outputs.kimi_release_tag }}
run: gh release upload "$RELEASE_TAG" dist-native-release/* --clobber

publish-plugin-marketplace:
name: Publish plugin marketplace
needs: release
if: needs.release.outputs.packages_published == 'true'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Gate marketplace publishing on Kimi Code releases

When a changesets publish only includes another workspace package, packages_published is still true, but apps/kimi-code/scripts/native/resolve-release.mjs emits should_publish=false and a fallback @moonshot-ai/kimi-code@<current package.json version> tag. This job will then upload the newly generated marketplace to the previous Kimi Code release (or fail if that tag is absent), so releases for e.g. the SDK/core can mutate the wrong release assets; use the Kimi Code-specific kimi_native_release/should_publish output for this job.

Useful? React with 👍 / 👎.

runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Download plugin marketplace artifact
uses: actions/download-artifact@v8
with:
name: plugin-marketplace
path: dist-plugin-marketplace
merge-multiple: true

- name: Upload plugin marketplace to GitHub Release
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ needs.release.outputs.kimi_release_tag }}
run: |
# The artifact contains files directly under dist-plugin-marketplace/
cd dist-plugin-marketplace
gh release upload "$RELEASE_TAG" marketplace.json --clobber

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Provide repository context to gh uploads

This new job downloads artifacts but never checks out the repository and does not pass --repo/set GH_REPO. I checked the gh manual (https://cli.github.com/manual/gh_help_environment): GH_REPO is the repository for commands that otherwise operate on a local repository, so from dist-plugin-marketplace after actions/download-artifact there is no local repo for gh release upload to infer and the upload fails before publishing any marketplace assets; add checkout or pass --repo ${{ github.repository }}.

Useful? React with 👍 / 👎.

find . -name "*.zip" -exec gh release upload "$RELEASE_TAG" {} --clobber \;
cd ..
# Also upload as a zip archive for convenience
zip -r plugin-marketplace.zip dist-plugin-marketplace
gh release upload "$RELEASE_TAG" plugin-marketplace.zip --clobber
3 changes: 2 additions & 1 deletion apps/kimi-code/scripts/build-plugin-marketplace-cdn.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ async function materializeEntrySource(source, pluginsRoot, outDir) {
const sourcePath = resolveInsideRoot(pluginsRoot, source);
const info = await stat(sourcePath).catch(() => undefined);
if (info === undefined) {
throw new Error(`Marketplace source does not exist: ${source}`);
console.warn(`Warning: Marketplace source does not exist, skipping: ${source}`);
return { source };
}

if (info.isDirectory()) {
Expand Down
Loading