Skip to content
Integrations

Publish Kubb Studio snapshots from CI

Run kubb studio snapshot in GitHub Actions, GitLab CI, or any CI provider to publish an installable package and review generated-code changes per pull request.

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

ProviderAgent identityGuide
GitHub ActionsDetectedPublish snapshots with GitHub Actions
GitLab CIDetectedPublish snapshots with GitLab CI
Bitbucket Pipelines, CircleCIDetected. Pass --base-id to compare with a branchRun kubb studio snapshot with KUBB_TOKEN set
OtherPass --id and --base-idSee 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.

Snapshots expire after seven days. Schedule a default-branch run if it can go a week without a push.

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:

Terminal
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 request

Use 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:

.npmrc
//kubb.studio/:_authToken=${KUBB_REGISTRY_TOKEN}
Terminal
npm i https://kubb.studio/packages/<agent>/<package>.tgz

pnpm 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:

.npmrc
@<scope>:registry=https://kubb.studio/