Publish Kubb Studio snapshots from CI
kubb studio snapshot generates a package on a CI runner, uploads it to Studio in one request, and exits. Run it on pull or merge requests and on the default branch so reviewers can compare their output.
Supported providers
| Provider | Agent identity | Guide |
|---|---|---|
| GitHub Actions | Detected | Publish snapshots with GitHub Actions |
| GitLab CI | Detected | Publish snapshots with GitLab CI |
| Bitbucket Pipelines, CircleCI | Detected. Pass --base-id to compare with a branch | Run kubb studio snapshot with KUBB_TOKEN set |
| Other | Pass --id and --base-id | See below |
Every provider needs an organization CI API key stored as KUBB_TOKEN. Snapshot installation uses a separate registry API key. Create both in Studio under Settings › Developers › Tokens.
A snapshot builds its dist files with tsdown, which Kubb does not install by default. Add it next to kubb in the development dependencies with npm i -D tsdown.
Other CI providers
For a provider without automatic agent identification, use a stable --id on the base branch and pass it as --base-id on pull request runs:
kubb studio snapshot --id jenkins:api:main # on main
kubb studio snapshot --id jenkins:api:pr-12 --base-id jenkins:api:main # on a pull requestUse kubb studio snapshot --json | jq -r '.url' to pass the tarball URL to another step. See CI agent identity and Snapshot output for the result fields.
Open the snapshot in Studio
Open the CI agent’s editor to read its latest unexpired package, comment on source lines, or preview generated HTML. Studio reads the stored tarball after the runner exits. Run the pipeline again to publish updated output.
Install the snapshot
Configure the registry API key, then run the install command from the snapshot result:
//kubb.studio/:_authToken=${KUBB_REGISTRY_TOKEN}npm i https://kubb.studio/packages/<agent>/<package>.tgzpnpm and Yarn install the same URL with the same .npmrc. Yarn 1 also needs the registry for the package's scope, or the install fails with HTTP 403:
@<scope>:registry=https://kubb.studio/