Skip to content

Commit a1213ea

Browse files
author
Michael Gasperini
committed
ci: publish releases through trusted publishing
1 parent e545b02 commit a1213ea

3 files changed

Lines changed: 55 additions & 5 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@ on:
44
push:
55
tags:
66
- 'v*.*.*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Release tag to publish (for example v0.1.5)'
11+
required: true
12+
type: string
713

814
permissions:
915
contents: read
1016

1117
jobs:
1218
github-release:
1319
name: Package GitHub release
20+
if: github.event_name == 'push'
1421
runs-on: ubuntu-latest
1522
timeout-minutes: 15
1623
permissions:
@@ -61,3 +68,44 @@ jobs:
6168
else
6269
gh release create "$GITHUB_REF_NAME" "$VSIX" "$VSIX.sha256" --generate-notes --title "Kimi Code CLI Launcher $GITHUB_REF_NAME" --verify-tag
6370
fi
71+
72+
publish:
73+
name: Publish released VSIX
74+
if: github.event_name == 'workflow_dispatch'
75+
runs-on: ubuntu-latest
76+
timeout-minutes: 15
77+
permissions:
78+
contents: read
79+
id-token: write
80+
81+
steps:
82+
- name: Download the released VSIX
83+
env:
84+
GH_TOKEN: ${{ github.token }}
85+
RELEASE_TAG: ${{ inputs.tag }}
86+
run: |
87+
set -euo pipefail
88+
VSIX="vscode-kimi-code-cli-launcher-${RELEASE_TAG#v}.vsix"
89+
mkdir -p .release
90+
gh release download "$RELEASE_TAG" \
91+
--repo "$GITHUB_REPOSITORY" \
92+
--pattern "$VSIX" \
93+
--pattern "$VSIX.sha256" \
94+
--dir .release
95+
(cd .release && sha256sum -c "$VSIX.sha256")
96+
97+
- name: Publish to Visual Studio Marketplace
98+
env:
99+
RELEASE_TAG: ${{ inputs.tag }}
100+
run: |
101+
npx --yes @vscode/vsce@4.1.0 publish \
102+
--packagePath ".release/vscode-kimi-code-cli-launcher-${RELEASE_TAG#v}.vsix" \
103+
--oidc --skip-duplicate
104+
105+
- name: Publish to Open VSX
106+
env:
107+
RELEASE_TAG: ${{ inputs.tag }}
108+
run: |
109+
npx --yes ovsx@1.3.0 publish \
110+
--packagePath ".release/vscode-kimi-code-cli-launcher-${RELEASE_TAG#v}.vsix" \
111+
--trusted-publishing --skip-duplicate

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Use `npm ci --ignore-scripts` for a clean, reproducible install. Do not replace
7070
- Add user-visible changes to the `Unreleased` section of `CHANGELOG.md`.
7171
- 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 <x.y.z> --no-git-tag-version` is the supported way to update the manifest and the lockfile together.
7272
- A `v<version>` tag triggers the GitHub release workflow. Do not create tags, push, publish, or upload Marketplace packages unless explicitly authorized.
73-
- 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.
73+
- 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.
7474
- `main` is protected and requires one approving review. Land changes through a branch and a pull request; never self-approve or bypass the protection.
7575
- Maintain the unofficial-project and trademark disclaimer. Do not imply endorsement by Moonshot AI or Kimi.
7676

‎CONTRIBUTING.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,13 @@ For a release:
110110

111111
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.
112112

113-
VS Code Marketplace and Open VSX publishing are separate manual maintainer steps:
113+
VS Code Marketplace and Open VSX publishing is owner-controlled and uses OIDC trusted publishing. After
114+
the GitHub release exists, dispatch the `Release` workflow with that release tag:
114115

115116
```bash
116-
npx @vscode/vsce publish --packagePath vscode-kimi-code-cli-launcher-<version>.vsix
117-
npx ovsx publish vscode-kimi-code-cli-launcher-<version>.vsix
117+
gh workflow run release.yml -f tag=v<x.y.z>
118118
```
119119

120-
These commands require registry publisher tokens. Tokens are deliberately absent from the repository, local automation, and GitHub Actions.
120+
The publish job downloads the released VSIX, verifies its checksum, and publishes it to both registries
121+
with short-lived OIDC credentials. No registry publisher token is stored in the repository, local
122+
automation, or GitHub Actions secrets.

0 commit comments

Comments
 (0)