[{"data":1,"prerenderedAt":391},["ShallowReactive",2],{"page:\u002Fdocs\u002F5.x\u002Fintegrations\u002Fci":3},{"id":4,"title":5,"body":6,"description":373,"extension":374,"frontmatter":375,"heading":5,"meta":382,"navigation":384,"order":369,"path":385,"seo":386,"sitemap":387,"source":388,"stem":389,"__hash__":390},"docs\u002Fdocs\u002F5.x\u002Fintegrations\u002Fci.md","Publish Kubb Studio snapshots from CI",{"type":7,"value":8,"toc":364},"minimark",[9,23,28,117,127,146,151,155,164,230,246,250,253,257,260,298,338,344],[10,11,12,16,17,22],"p",{},[13,14,15],"code",{},"kubb studio snapshot"," generates a package on a CI runner, uploads it to ",[18,19,21],"a",{"href":20},"\u002Fdocs\u002F5.x\u002Fintegrations\u002Fstudio","Studio"," in one request, and exits. Run it on pull or merge requests and on the default branch so reviewers can compare their output.",[24,25,27],"h2",{"id":26},"supported-providers","Supported providers",[29,30,31,47],"table",{},[32,33,34],"thead",{},[35,36,37,41,44],"tr",{},[38,39,40],"th",{},"Provider",[38,42,43],{},"Agent identity",[38,45,46],{},"Guide",[48,49,50,65,78,100],"tbody",{},[35,51,52,56,59],{},[53,54,55],"td",{},"GitHub Actions",[53,57,58],{},"Detected",[53,60,61],{},[18,62,64],{"href":63},"\u002Fdocs\u002F5.x\u002Fintegrations\u002Fgithub-actions","Publish snapshots with GitHub Actions",[35,66,67,70,72],{},[53,68,69],{},"GitLab CI",[53,71,58],{},[53,73,74],{},[18,75,77],{"href":76},"\u002Fdocs\u002F5.x\u002Fintegrations\u002Fgitlab","Publish snapshots with GitLab CI",[35,79,80,83,90],{},[53,81,82],{},"Bitbucket Pipelines, CircleCI",[53,84,85,86,89],{},"Detected. Pass ",[13,87,88],{},"--base-id"," to compare with a branch",[53,91,92,93,95,96,99],{},"Run ",[13,94,15],{}," with ",[13,97,98],{},"KUBB_TOKEN"," set",[35,101,102,105,114],{},[53,103,104],{},"Other",[53,106,107,108,111,112],{},"Pass ",[13,109,110],{},"--id"," and ",[13,113,88],{},[53,115,116],{},"See below",[10,118,119,120,122,123,126],{},"Every provider needs an organization CI API key stored as ",[13,121,98],{},". Snapshot installation uses a separate ",[13,124,125],{},"registry"," API key. Create both in Studio under Settings › Developers › Tokens.",[10,128,129,130,133,134,137,138,141,142,145],{},"A snapshot builds its ",[13,131,132],{},"dist"," files with ",[13,135,136],{},"tsdown",", which Kubb does not install by default. Add it next to ",[13,139,140],{},"kubb"," in the development dependencies with ",[13,143,144],{},"npm i -D tsdown",".",[147,148,150],"blockquote",{"as":149},"note","Snapshots expire after seven days. Schedule a default-branch run if it can go a week without a push.",[24,152,154],{"id":153},"other-ci-providers","Other CI providers",[10,156,157,158,160,161,163],{},"For a provider without automatic agent identification, use a stable ",[13,159,110],{}," on the base branch and pass it as ",[13,162,88],{}," on pull request runs:",[165,166,171],"pre",{"language":167,"filename":168,"code":169,"class":170},"shell","Terminal","kubb studio snapshot --id jenkins:api:main                              # on main\nkubb studio snapshot --id jenkins:api:pr-12 --base-id jenkins:api:main  # on a pull request","highlights",[13,172,174,202,203],{"class":173},"language-shell",[175,176,179,183,187,190,193,195,198],"span",{"class":177,"style":178},"line","display: inline",[175,180,182],{"style":181},"color:#6f42c1;--hls-dark:#b392f0","kubb ",[175,184,186],{"style":185},"color:#24292e;--hls-dark:#e1e4e8","studio snapshot --id jenkins",[175,188,189],{"style":185},":",[175,191,192],{"style":185},"api",[175,194,189],{"style":185},[175,196,197],{"style":185},"main                              ",[175,199,201],{"style":200},"color:#6a737d;--hls-dark:#6a737d","# on main","\n",[175,204,205,207,209,211,213,215,218,220,222,224,227],{"class":177,"style":178},[175,206,182],{"style":181},[175,208,186],{"style":185},[175,210,189],{"style":185},[175,212,192],{"style":185},[175,214,189],{"style":185},[175,216,217],{"style":185},"pr-12 --base-id jenkins",[175,219,189],{"style":185},[175,221,192],{"style":185},[175,223,189],{"style":185},[175,225,226],{"style":185},"main  ",[175,228,229],{"style":200},"# on a pull request",[10,231,232,233,236,237,111,241,245],{},"Use ",[13,234,235],{},"kubb studio snapshot --json | jq -r '.url'"," to pass the tarball URL to another step. See ",[18,238,240],{"href":239},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fstudio#ci-agent-identity","CI agent identity",[18,242,244],{"href":243},"\u002Fdocs\u002F5.x\u002Freference\u002Fcommands\u002Fstudio#snapshot-output","Snapshot output"," for the result fields.",[24,247,249],{"id":248},"open-the-snapshot-in-studio","Open the snapshot in Studio",[10,251,252],{},"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.",[24,254,256],{"id":255},"install-the-snapshot","Install the snapshot",[10,258,259],{},"Configure the registry API key, then run the install command from the snapshot result:",[165,261,265],{"language":262,"filename":263,"code":264,"class":170},"ini",".npmrc","\u002F\u002Fkubb.studio\u002F:_authToken=${KUBB_REGISTRY_TOKEN}",[13,266,268],{"class":267},"language-ini",[175,269,270,273,276,280,283,286,289,292,295],{"class":177,"style":178},[175,271,272],{"style":185},"\u002F\u002Fkubb",[175,274,145],{"style":275},"color:#d73a49;--hls-dark:#f97583",[175,277,279],{"style":278},"color:#005cc5;--hls-dark:#79b8ff","studio",[175,281,282],{"style":185},"\u002F:_authToken",[175,284,285],{"style":275},"=",[175,287,288],{"style":185},"$",[175,290,291],{"style":278},"{",[175,293,294],{"style":278},"KUBB_REGISTRY_TOKEN",[175,296,297],{"style":278},"}",[165,299,301],{"language":167,"filename":168,"code":300,"class":170},"npm i https:\u002F\u002Fkubb.studio\u002Fpackages\u002F\u003Cagent>\u002F\u003Cpackage>.tgz",[13,302,303],{"class":173},[175,304,305,308,311,313,316,319,322,325,328,330,333,335],{"class":177,"style":178},[175,306,307],{"style":181},"npm ",[175,309,310],{"style":185},"i https",[175,312,189],{"style":185},[175,314,315],{"style":185},"\u002F\u002Fkubb.studio\u002Fpackages\u002F",[175,317,318],{"style":275},"\u003C",[175,320,321],{"style":185},"agent",[175,323,324],{"style":275},">",[175,326,327],{"style":185},"\u002F",[175,329,318],{"style":275},[175,331,332],{"style":185},"package",[175,334,324],{"style":275},[175,336,337],{"style":185},".tgz",[10,339,340,341,343],{},"pnpm and Yarn install the same URL with the same ",[13,342,263],{},". Yarn 1 also needs the registry for the package's scope, or the install fails with HTTP 403:",[165,345,347],{"language":262,"filename":263,"code":346,"class":170},"@\u003Cscope>:registry=https:\u002F\u002Fkubb.studio\u002F",[13,348,349],{"class":267},[175,350,351,354,356,359,361],{"class":177,"style":178},[175,352,353],{"style":185},"@\u003Cscope>:registry",[175,355,285],{"style":275},[175,357,358],{"style":185},"https:\u002F\u002Fkubb",[175,360,145],{"style":275},[175,362,363],{"style":185},"studio\u002F",{"title":365,"searchDepth":366,"depth":366,"links":367},"",5,[368,370,371,372],{"id":26,"depth":369,"text":27},2,{"id":153,"depth":369,"text":154},{"id":248,"depth":369,"text":249},{"id":255,"depth":369,"text":256},"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.","md",{"layout":376,"title":5,"description":373,"outline":377,"order":369,"navigation":379},"doc",[369,378],3,{"title":380,"icon":381},"CI snapshots","i-iconoir-git-merge",{"layout":376,"outline":383},[369,378],{"title":380,"icon":381},"\u002Fdocs\u002F5.x\u002Fintegrations\u002Fci",{"title":5,"description":373},{"loc":385},"kubb-labs\u002Fkubb\u002Fdocs\u002F5.x\u002Fintegrations\u002Fci.md","docs\u002F5.x\u002Fintegrations\u002Fci","rFy7jL9-13LVeLjSk_eJDrLss6Kq3UmhJ0Q_si7biD4",1792931641017]