[{"data":1,"prerenderedAt":696},["ShallowReactive",2],{"docs-\u002Fdocs\u002Fsite-kit\u002Fdeploy":3,"docs-navigation":550,"docs-surround-\u002Fdocs\u002Fsite-kit\u002Fdeploy":693},{"id":4,"title":5,"body":6,"description":542,"extension":543,"icon":544,"meta":545,"navigation":544,"path":546,"seo":547,"stem":548,"__hash__":549},"docs\u002Fdocs\u002F4.site-kit\u002F06.deploy.md","Deploy with Hostsmith",{"type":7,"value":8,"toc":532},"minimark",[9,13,22,48,53,79,88,92,140,144,151,186,190,193,241,248,252,263,291,300,303,362,366,369,407,414,424,428,500,510,514,528],[10,11,5],"h1",{"id":12},"deploy-with-hostsmith",[14,15,16,17,21],"p",{},"Every kit site has the deploy workflow ",[18,19,20],"code",{},".github\u002Fworkflows\u002Fhostsmith.yml",". Once it's set up:",[23,24,25,38,45],"ul",{},[26,27,28,29,32,33,37],"li",{},"a push to ",[18,30,31],{},"main"," builds the site and deploys it to the ",[34,35,36],"strong",{},"production site",";",[26,39,40,41,44],{},"a push to any other branch deploys it to the ",[34,42,43],{},"preview site",", so the client can see a change before it goes live;",[26,46,47],{},"the repository's deployments list links each deploy to its site.",[49,50,52],"h2",{"id":51},"what-you-need","What you need",[23,54,55,61,67,73],{},[26,56,57,60],{},[34,58,59],{},"A Hostsmith plan with two sites",", one for production and one for previews: Pro or above. On Free and Starter, which have one site, set up production only, and branch pushes only build.",[26,62,63,66],{},[34,64,65],{},"For the client's own domain:"," Pro or above.",[26,68,69,72],{},[34,70,71],{},"For the EU data partition:"," Agency or Premium.",[26,74,75,78],{},[34,76,77],{},"The organization's owner"," to create the API tokens.",[14,80,81,82,87],{},"See ",[83,84,86],"a",{"href":85},"\u002Fpricing","Pricing"," for the plans.",[49,89,91],{"id":90},"_1-create-the-two-sites","1. Create the two sites",[93,94,95,106,123,129],"ol",{},[26,96,97,98,101,102,105],{},"In the Hostsmith dashboard, open ",[34,99,100],{},"Sites"," and click ",[34,103,104],{},"Add",".",[26,107,108,109,112,113,116,117,120,121,105],{},"Pick the data partition, enter a subdomain, such as ",[18,110,111],{},"acme",", and pick a domain. Under ",[34,114,115],{},"Files",", add a placeholder page, such as an ",[18,118,119],{},"index.html"," that says \"Coming soon\": the workflow's first deploy replaces it. Click ",[34,122,104],{},[26,124,125,126,105],{},"Add a second site for previews the same way, such as ",[18,127,128],{},"acme-preview",[26,130,131,132,135,136,139],{},"In the sites list, open each site with ",[34,133,134],{},"Edit site",". The card at the top shows its ",[34,137,138],{},"Site ID",": copy it with the button beside it, and keep both ids for the next steps.",[49,141,143],{"id":142},"_2-name-the-production-site","2. Name the production site",[14,145,146,147,150],{},"Set the production site's id in ",[18,148,149],{},"hostsmith.json",", at the root of the repository, and commit it:",[152,153,158],"pre",{"className":154,"code":155,"language":156,"meta":157,"style":157},"language-json shiki shiki-themes github-dark","\"site\": { \"id\": \"PRODUCTION-SITE-ID\" }\n","json","",[18,159,160],{"__ignoreMap":157},[161,162,165,169,173,177,180,183],"span",{"class":163,"line":164},"line",1,[161,166,168],{"class":167},"sU2Wk","\"site\"",[161,170,172],{"class":171},"s95oV",": { ",[161,174,176],{"class":175},"sDLfK","\"id\"",[161,178,179],{"class":171},": ",[161,181,182],{"class":167},"\"PRODUCTION-SITE-ID\"",[161,184,185],{"class":171}," }\n",[49,187,189],{"id":188},"_3-create-two-api-tokens","3. Create two API tokens",[14,191,192],{},"Each target gets its own token, restricted to its site, so a branch can never deploy to production.",[93,194,195,204,210,224,231,238],{},[26,196,197,198,101,201,105],{},"In the dashboard menu, open ",[34,199,200],{},"API Tokens",[34,202,203],{},"New token",[26,205,206,207,105],{},"Give it a name, such as ",[18,208,209],{},"acme production deploys",[26,211,212,213,216,217,220,221,105],{},"Under permissions, pick ",[34,214,215],{},"Custom",", and check ",[18,218,219],{},"sites:read"," and ",[18,222,223],{},"files:write",[26,225,226,227,230],{},"Under sites, pick ",[34,228,229],{},"Only selected sites",", and check the production site.",[26,232,233,234,237],{},"Pick an expiry, click ",[34,235,236],{},"Create token",", and copy the token. It's shown once.",[26,239,240],{},"Create a second token the same way for the preview site.",[14,242,243,247],{},[83,244,246],{"href":245},"\u002Fdocs\u002Fdevelopers\u002Fauthentication#api-tokens","API tokens"," explains the permissions and how to revoke a token.",[49,249,251],{"id":250},"_4-set-up-the-repository","4. Set up the repository",[14,253,254,255,258,259,262],{},"In the GitHub repository's ",[34,256,257],{},"Settings",", under ",[34,260,261],{},"Environments",":",[93,264,265,279],{},[26,266,267,268,271,272,275,276,278],{},"Create the environment ",[18,269,270],{},"production",". Add the secret ",[18,273,274],{},"HOSTSMITH_TOKEN"," with the production token. Under deployment branches, allow only ",[18,277,31],{},", so other branches can't use this token.",[26,280,267,281,271,284,286,287,290],{},[18,282,283],{},"preview",[18,285,274],{}," with the preview token, and the variable ",[18,288,289],{},"HOSTSMITH_PREVIEW_SITE_ID"," with the preview site's id.",[14,292,293,294,296,297,299],{},"Private repositories on GitHub Free have no environment secrets. There, create one token restricted to both sites, add it as the repository secret ",[18,295,274],{},", and add ",[18,298,289],{}," as a repository variable.",[14,301,302],{},"The workflow also reads these variables, in the repository or an environment:",[304,305,306,319],"table",{},[307,308,309],"thead",{},[310,311,312,316],"tr",{},[313,314,315],"th",{},"Variable",[313,317,318],{},"What it is",[320,321,322,332,349],"tbody",{},[310,323,324,329],{},[325,326,327],"td",{},[18,328,289],{},[325,330,331],{},"The preview site's id. Without it, branch pushes only build.",[310,333,334,339],{},[325,335,336],{},[18,337,338],{},"HOSTSMITH_PARTITION",[325,340,341,344,345,348],{},[18,342,343],{},"us"," or ",[18,346,347],{},"eu",", when the sites aren't in your organization's home data partition.",[310,350,351,356],{},[325,352,353],{},[18,354,355],{},"SITE_NOINDEX",[325,357,358,361],{},[18,359,360],{},"true"," until the client's domain points to Hostsmith, so search engines don't index the production site's Hostsmith address. Previews are always no-index.",[49,363,365],{"id":364},"_5-deploy","5. Deploy",[14,367,368],{},"Push a branch:",[152,370,374],{"className":371,"code":372,"language":373,"meta":157,"style":157},"language-bash shiki shiki-themes github-dark","git switch -c first-preview\ngit push -u origin first-preview\n","bash",[18,375,376,391],{"__ignoreMap":157},[161,377,378,382,385,388],{"class":163,"line":164},[161,379,381],{"class":380},"svObZ","git",[161,383,384],{"class":167}," switch",[161,386,387],{"class":175}," -c",[161,389,390],{"class":167}," first-preview\n",[161,392,394,396,399,402,405],{"class":163,"line":393},2,[161,395,381],{"class":380},[161,397,398],{"class":167}," push",[161,400,401],{"class":175}," -u",[161,403,404],{"class":167}," origin",[161,406,390],{"class":167},[14,408,409,410,413],{},"The workflow's ",[34,411,412],{},"Hostsmith"," run checks the settings first, and names any that are missing. Then it checks the styles, builds, and deploys to the preview site. Open the run's deployment link to see the site.",[14,415,416,417,419,420,423],{},"A push to ",[18,418,31],{},", such as merging the branch, deploys to the production site the same way. To deploy without a push, run the workflow from the repository's ",[34,421,422],{},"Actions"," tab and pick the target.",[49,425,427],{"id":426},"_6-move-to-the-clients-domain","6. Move to the client's domain",[93,429,430,437,445,460,472],{},[26,431,432,433,105],{},"Check the old site's URLs first, if the site replaces one: see ",[83,434,436],{"href":435},"\u002Fdocs\u002Fsite-kit\u002Fold-urls","Keep old URLs",[26,438,439,440,444],{},"Add the domain to the production site, as ",[83,441,443],{"href":442},"\u002Fdocs\u002Fgetting-started\u002Fcustom-domains","Custom domains"," explains, and wait until it's active.",[26,446,447,448,451,452,455,456,459],{},"Set ",[18,449,450],{},"url"," in ",[18,453,454],{},"src\u002Fsite.config.ts"," to the domain, such as ",[18,457,458],{},"https:\u002F\u002Fwww.example.com",". The site's canonical links and sitemap use it.",[26,461,462,463,465,466,469,470,105],{},"Delete the variable ",[18,464,355],{},", or set it to ",[18,467,468],{},"false",", and push to ",[18,471,31],{},[26,473,474,475],{},"Check the live site against the old URLs:",[152,476,478],{"className":371,"code":477,"language":373,"meta":157,"style":157},"npm run check:urls -- --live https:\u002F\u002Fwww.example.com\n",[18,479,480],{"__ignoreMap":157},[161,481,482,485,488,491,494,497],{"class":163,"line":164},[161,483,484],{"class":380},"npm",[161,486,487],{"class":167}," run",[161,489,490],{"class":167}," check:urls",[161,492,493],{"class":175}," --",[161,495,496],{"class":175}," --live",[161,498,499],{"class":167}," https:\u002F\u002Fwww.example.com\n",[14,501,502,503,509],{},"The ",[83,504,508],{"href":505,"rel":506},"https:\u002F\u002Fgithub.com\u002Fhostsmith\u002Fsite-kit-astro\u002Fblob\u002Fmain\u002FREADME.md#deploying-to-hostsmith",[507],"nofollow","kit's README"," has the workflow's settings in one table.",[49,511,513],{"id":512},"another-host","Another host",[14,515,516,517,520,521,524,525,527],{},"A kit site builds to static files in ",[18,518,519],{},"dist\u002F",", and any static host can serve them: build with ",[18,522,523],{},"npm run build"," and deploy ",[18,526,519],{}," as that host documents. The deploy workflow is the only part of the site that names Hostsmith.",[529,530,531],"style",{},"html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}",{"title":157,"searchDepth":393,"depth":393,"links":533},[534,535,536,537,538,539,540,541],{"id":51,"depth":393,"text":52},{"id":90,"depth":393,"text":91},{"id":142,"depth":393,"text":143},{"id":188,"depth":393,"text":189},{"id":250,"depth":393,"text":251},{"id":364,"depth":393,"text":365},{"id":426,"depth":393,"text":427},{"id":512,"depth":393,"text":513},"Deploy a kit site from GitHub to a Hostsmith production site, with a preview site for every branch, then move it to the client's domain.","md",null,{},"\u002Fdocs\u002Fsite-kit\u002Fdeploy",{"title":5,"description":542},"docs\u002F4.site-kit\u002F06.deploy","JS-P7SL1QX8IuQMHUnn3QYO2MVBH8pJVDuuNWRtIu9s",[551],{"title":552,"path":553,"stem":554,"children":555,"page":692},"Docs","\u002Fdocs","docs",[556,581,593,628,674],{"title":557,"path":558,"stem":559,"children":560,"page":-1,"icon":562},"Getting Started","\u002Fdocs\u002Fgetting-started","docs\u002F1.getting-started\u002Findex",[561,563,567,571,574,577],{"title":557,"path":558,"stem":559,"icon":562},"solar:rocket-bold",{"title":564,"path":565,"stem":566},"Introduction","\u002Fdocs\u002Fgetting-started\u002Fintroduction","docs\u002F1.getting-started\u002F1.introduction",{"title":568,"path":569,"stem":570},"Quick Start","\u002Fdocs\u002Fgetting-started\u002Fquick-start","docs\u002F1.getting-started\u002F2.quick-start",{"title":100,"path":572,"stem":573},"\u002Fdocs\u002Fgetting-started\u002Fsites","docs\u002F1.getting-started\u002F3.sites",{"title":575,"path":442,"stem":576},"Custom Domains","docs\u002F1.getting-started\u002F4.custom-domains",{"title":578,"path":579,"stem":580},"Support","\u002Fdocs\u002Fgetting-started\u002Fsupport","docs\u002F1.getting-started\u002F5.support",{"title":582,"path":583,"stem":584,"children":585,"page":-1,"icon":587},"Integrations","\u002Fdocs\u002Fintegrations","docs\u002F2.integrations\u002Findex",[586,588],{"title":582,"path":583,"stem":584,"icon":587},"ph:usb-bold",{"title":589,"path":590,"stem":591,"icon":592},"n8n","\u002Fdocs\u002Fintegrations\u002Fn8n","docs\u002F2.integrations\u002F1.n8n","simple-icons:n8n",{"title":594,"path":595,"stem":596,"children":597,"page":-1,"icon":599},"MCP","\u002Fdocs\u002Fmcp","docs\u002F3.mcp\u002Findex",[598,600,604,608,612,616,620,624],{"title":594,"path":595,"stem":596,"icon":599},"solar:plug-circle-bold",{"title":601,"path":602,"stem":603},"Quick start","\u002Fdocs\u002Fmcp\u002Fquick-start","docs\u002F3.mcp\u002F1.quick-start",{"title":605,"path":606,"stem":607},"Clients","\u002Fdocs\u002Fmcp\u002Fclients","docs\u002F3.mcp\u002F2.clients",{"title":609,"path":610,"stem":611},"Authentication","\u002Fdocs\u002Fmcp\u002Fauthentication","docs\u002F3.mcp\u002F3.authentication",{"title":613,"path":614,"stem":615},"Tools","\u002Fdocs\u002Fmcp\u002Ftools","docs\u002F3.mcp\u002F4.tools",{"title":617,"path":618,"stem":619},"Recipes","\u002Fdocs\u002Fmcp\u002Frecipes","docs\u002F3.mcp\u002F5.recipes",{"title":621,"path":622,"stem":623},"Limits and errors","\u002Fdocs\u002Fmcp\u002Flimits-and-errors","docs\u002F3.mcp\u002F6.limits-and-errors",{"title":625,"path":626,"stem":627},"FAQ","\u002Fdocs\u002Fmcp\u002Ffaq","docs\u002F3.mcp\u002F7.faq",{"title":629,"path":630,"stem":631,"children":632,"page":-1,"icon":634},"Site kit","\u002Fdocs\u002Fsite-kit","docs\u002F4.site-kit\u002Findex",[633,635,639,643,647,651,655,656,658,662,666,670],{"title":629,"path":630,"stem":631,"icon":634},"solar:layers-bold",{"title":636,"path":637,"stem":638},"Overview","\u002Fdocs\u002Fsite-kit\u002Foverview","docs\u002F4.site-kit\u002F01.overview",{"title":640,"path":641,"stem":642},"Start a site","\u002Fdocs\u002Fsite-kit\u002Fstart-a-site","docs\u002F4.site-kit\u002F02.start-a-site",{"title":644,"path":645,"stem":646},"Content","\u002Fdocs\u002Fsite-kit\u002Fcontent","docs\u002F4.site-kit\u002F03.content",{"title":648,"path":649,"stem":650},"Design","\u002Fdocs\u002Fsite-kit\u002Fdesign","docs\u002F4.site-kit\u002F04.design",{"title":652,"path":653,"stem":654},"Languages","\u002Fdocs\u002Fsite-kit\u002Flanguages","docs\u002F4.site-kit\u002F05.languages",{"title":5,"path":546,"stem":548},{"title":436,"path":435,"stem":657},"docs\u002F4.site-kit\u002F07.old-urls",{"title":659,"path":660,"stem":661},"Work with an AI agent","\u002Fdocs\u002Fsite-kit\u002Fai-agents","docs\u002F4.site-kit\u002F08.ai-agents",{"title":663,"path":664,"stem":665},"Kit updates","\u002Fdocs\u002Fsite-kit\u002Fupdates","docs\u002F4.site-kit\u002F09.updates",{"title":667,"path":668,"stem":669},"Existing Astro sites","\u002Fdocs\u002Fsite-kit\u002Fexisting-astro-sites","docs\u002F4.site-kit\u002F10.existing-astro-sites",{"title":671,"path":672,"stem":673},"External CMS","\u002Fdocs\u002Fsite-kit\u002Fexternal-cms","docs\u002F4.site-kit\u002F11.external-cms",{"title":675,"path":676,"stem":677,"children":678,"page":-1,"icon":680},"Developers","\u002Fdocs\u002Fdevelopers","docs\u002F5.developers\u002Findex",[679,681,684,688],{"title":675,"path":676,"stem":677,"icon":680},"solar:code-bold",{"title":609,"path":682,"stem":683},"\u002Fdocs\u002Fdevelopers\u002Fauthentication","docs\u002F5.developers\u002F1.authentication",{"title":685,"path":686,"stem":687},"API Explorer","\u002Fdocs\u002Fdevelopers\u002Fapi-explorer","docs\u002F5.developers\u002F2.api-explorer",{"title":689,"path":690,"stem":691},"Node.js SDK","\u002Fdocs\u002Fdevelopers\u002Fsdk","docs\u002F5.developers\u002F3.sdk",false,[694,695],{"title":652,"path":653,"stem":654,"children":-1},{"title":436,"path":435,"stem":657,"children":-1},1792842401880]