diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9f36d9c..cfc8345 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,12 @@ on: push: tags: - 'v*.*.*' + workflow_dispatch: + inputs: + tag: + description: 'Release tag to publish (for example v0.1.5)' + required: true + type: string permissions: contents: read @@ -11,6 +17,7 @@ permissions: jobs: github-release: name: Package GitHub release + if: github.event_name == 'push' runs-on: ubuntu-latest timeout-minutes: 15 permissions: @@ -61,3 +68,44 @@ jobs: else gh release create "$GITHUB_REF_NAME" "$VSIX" "$VSIX.sha256" --generate-notes --title "Kimi Code CLI Launcher $GITHUB_REF_NAME" --verify-tag fi + + publish: + name: Publish released VSIX + if: github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + id-token: write + + steps: + - name: Download the released VSIX + env: + GH_TOKEN: ${{ github.token }} + RELEASE_TAG: ${{ inputs.tag }} + run: | + set -euo pipefail + VSIX="vscode-kimi-code-cli-launcher-${RELEASE_TAG#v}.vsix" + mkdir -p .release + gh release download "$RELEASE_TAG" \ + --repo "$GITHUB_REPOSITORY" \ + --pattern "$VSIX" \ + --pattern "$VSIX.sha256" \ + --dir .release + (cd .release && sha256sum -c "$VSIX.sha256") + + - name: Publish to Visual Studio Marketplace + env: + RELEASE_TAG: ${{ inputs.tag }} + run: | + npx --yes @vscode/vsce@4.1.0 publish \ + --packagePath ".release/vscode-kimi-code-cli-launcher-${RELEASE_TAG#v}.vsix" \ + --oidc --skip-duplicate + + - name: Publish to Open VSX + env: + RELEASE_TAG: ${{ inputs.tag }} + run: | + npx --yes ovsx@1.3.0 publish \ + --packagePath ".release/vscode-kimi-code-cli-launcher-${RELEASE_TAG#v}.vsix" \ + --trusted-publishing --skip-duplicate diff --git a/AGENTS.md b/AGENTS.md index 40b4eaf..b9e5e2f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -70,7 +70,7 @@ Use `npm ci --ignore-scripts` for a clean, reproducible install. Do not replace - Add user-visible changes to the `Unreleased` section of `CHANGELOG.md`. - For a release, keep versions synchronized in `package.json`, `package-lock.json`, `CITATION.cff`, and `test/metadata.test.js`; keep the real release date synchronized between `CITATION.cff` and `CHANGELOG.md`. `npm version --no-git-tag-version` is the supported way to update the manifest and the lockfile together. - A `v` tag triggers the GitHub release workflow. Do not create tags, push, publish, or upload Marketplace packages unless explicitly authorized. -- The extension is published as `mikesoft.vscode-kimi-code-cli-launcher` on the VS Code Marketplace and on Open VSX. Both registries are updated manually by the maintainer with `vsce publish` and `ovsx publish`; the required tokens are deliberately absent from this repository, from the shell environment, and from GitHub Actions secrets, so no workflow or agent can publish. Never add them. +- The extension is published as `mikesoft.vscode-kimi-code-cli-launcher` on the VS Code Marketplace and on Open VSX. Both registries are updated by the owner by manually dispatching the `Release` workflow with an existing release tag; it uses OIDC trusted publishing, so no long-lived registry token is stored in the repository, the shell environment, or GitHub Actions secrets. Never add publishing tokens. - `main` is protected and requires one approving review. Land changes through a branch and a pull request; never self-approve or bypass the protection. - Maintain the unofficial-project and trademark disclaimer. Do not imply endorsement by Moonshot AI or Kimi. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aec6c7d..f0b526e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -110,11 +110,13 @@ For a release: The `Release` workflow verifies the tag/version match, reruns validation and the security audit, packages the VSIX, creates a SHA-256 checksum, and creates or updates the GitHub release. -VS Code Marketplace and Open VSX publishing are separate manual maintainer steps: +VS Code Marketplace and Open VSX publishing is owner-controlled and uses OIDC trusted publishing. After +the GitHub release exists, dispatch the `Release` workflow with that release tag: ```bash -npx @vscode/vsce publish --packagePath vscode-kimi-code-cli-launcher-.vsix -npx ovsx publish vscode-kimi-code-cli-launcher-.vsix +gh workflow run release.yml -f tag=v ``` -These commands require registry publisher tokens. Tokens are deliberately absent from the repository, local automation, and GitHub Actions. +The publish job downloads the released VSIX, verifies its checksum, and publishes it to both registries +with short-lived OIDC credentials. No registry publisher token is stored in the repository, local +automation, or GitHub Actions secrets.