import{s as ns,n as ps,o as is}from"../chunks/scheduler.d6170356.js";import{S as Ms,i as rs,g as p,s as a,r as d,A as os,h as i,f as l,c as n,j as es,u as A,x as r,k as as,y as cs,a as e,v as b,d as B,t as E,w as S}from"../chunks/index.fcd4cc08.js";import{C as P}from"../chunks/CodeBlock.7b16bdef.js";import{H as ys,E as Us}from"../chunks/EditOnGithub.da2b595c.js";function ws(W){let M,k,f,$,o,v,c,X="You can keep your app in sync with your GitHub repository with a <strong>CircleCI workflow</strong>.",H,y,O='<a href="https://circleci.com" rel="nofollow">CircleCI</a> is a continuous integration and continuous delivery (CI/CD) platform that helps automate the software development process. A <a href="https://circleci.com/docs/workflows/" rel="nofollow">CircleCI workflow</a> is a set of automated tasks defined in a configuration file, orchestrated by CircleCI, to streamline the process of building, testing, and deploying software applications.',N,U,q='<em>Note: For files larger than 10MB, Spaces requires Git-LFS. If you don’t want to use Git-LFS, you may need to review your files and check your history. Use a tool like <a href="https://rtyley.github.io/bfg-repo-cleaner/" rel="nofollow">BFG Repo-Cleaner</a> to remove any large files from your history. BFG Repo-Cleaner will keep a local copy of your repository as a backup.</em>',Z,w,D="First, set up your GitHub repository and Spaces app together. Add your Spaces app as an additional remote to your existing Git repository.",_,T,G,h,K="Then force push to sync everything for the first time:",F,C,Q,J,ss='Next, set up a <a href="https://circleci.com/docs/workflows/" rel="nofollow">CircleCI workflow</a> to push your <code>main</code> git branch to Spaces.',R,m,ts="In the example below:",V,j,ls='<li>Replace <code>HF_USERNAME</code> with your username and <code>SPACE_NAME</code> with your Space name.</li> <li><a href="https://circleci.com/docs/contexts/" rel="nofollow">Create a context in CircleCI</a> and add an env variable into it called <em>HF_PERSONAL_TOKEN</em> (you can give it any name, use the key you create in place of HF_PERSONAL_TOKEN) and the value as your Hugging Face API token. You can find your Hugging Face API token under <strong>API Tokens</strong> on <a href="https://huggingface.co/settings/tokens" rel="nofollow">your Hugging Face profile</a>.</li>',x,u,z,I,Y,g,L;return o=new ys({props:{title:"Managing Spaces with CircleCI Workflows",local:"managing-spaces-with-circleci-workflows",headingTag:"h1"}}),T=new P({props:{code:"Z2l0JTIwcmVtb3RlJTIwYWRkJTIwc3BhY2UlMjBodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGc3BhY2VzJTJGSEZfVVNFUk5BTUUlMkZTUEFDRV9OQU1F",highlighted:"git remote add space https://huggingface.co/spaces/HF_USERNAME/SPACE_NAME",wrap:!1}}),C=new P({props:{code:"Z2l0JTIwcHVzaCUyMC0tZm9yY2UlMjBzcGFjZSUyMG1haW4=",highlighted:"git push --force space main",wrap:!1}}),u=new P({props:{code:"dmVyc2lvbiUzQSUyMDIuMSUwQSUwQXdvcmtmbG93cyUzQSUwQSUyMCUyMG1haW4lM0ElMEElMjAlMjAlMjAlMjBqb2JzJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwLSUyMHN5bmMtdG8taHVnZ2luZ2ZhY2UlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBjb250ZXh0JTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLSUyMEh1Z2dpbmdGYWNlJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZmlsdGVycyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJyYW5jaGVzJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb25seSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMC0lMjBtYWluJTBBJTBBam9icyUzQSUwQSUyMCUyMHN5bmMtdG8taHVnZ2luZ2ZhY2UlM0ElMEElMjAlMjAlMjAlMjBkb2NrZXIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAtJTIwaW1hZ2UlM0ElMjBhbHBpbmUlM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9QRVJTT05BTF9UT0tFTiU3RCU0MGh1Z2dpbmdmYWNlLmNvJTJGc3BhY2VzJTJGSEZfVVNFUk5BTUUlMkZTUEFDRV9OQU1FJTIwbWFpbg==",highlighted:`<span class="hljs-attr">version:</span> <span class="hljs-number">2.1</span>

<span class="hljs-attr">workflows:</span>
  <span class="hljs-attr">main:</span>
    <span class="hljs-attr">jobs:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">sync-to-huggingface:</span>
          <span class="hljs-attr">context:</span>
            <span class="hljs-bullet">-</span> <span class="hljs-string">HuggingFace</span>
          <span class="hljs-attr">filters:</span>
            <span class="hljs-attr">branches:</span>
              <span class="hljs-attr">only:</span>
                <span class="hljs-bullet">-</span> <span class="hljs-string">main</span>

<span class="hljs-attr">jobs:</span>
  <span class="hljs-attr">sync-to-huggingface:</span>
    <span class="hljs-attr">docker:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">image:</span> <span class="hljs-string">alpine</span>
    <span class="hljs-attr">resource_class:</span> <span class="hljs-string">small</span>
    <span class="hljs-attr">steps:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">run:</span> 
          <span class="hljs-attr">name:</span> <span class="hljs-string">install</span> <span class="hljs-string">git</span>
          <span class="hljs-attr">command:</span> <span class="hljs-string">apk</span> <span class="hljs-string">update</span> <span class="hljs-string">&amp;&amp;</span> <span class="hljs-string">apk</span> <span class="hljs-string">add</span> <span class="hljs-string">openssh-client</span> <span class="hljs-string">git</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">checkout</span>
      <span class="hljs-bullet">-</span> <span class="hljs-attr">run:</span>
          <span class="hljs-attr">name:</span> <span class="hljs-string">push</span> <span class="hljs-string">to</span> <span class="hljs-string">Huggingface</span> <span class="hljs-string">hub</span>
          <span class="hljs-attr">command:</span> <span class="hljs-string">|
                  git config user.email &quot;&lt;your-email@here&gt;&quot; 
                  git config user.name &quot;&lt;your-identifier&gt;&quot; 
                  git push -f https://HF_USERNAME:\${HF_PERSONAL_TOKEN}@huggingface.co/spaces/HF_USERNAME/SPACE_NAME main</span>`,wrap:!1}}),I=new Us({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/spaces-circleci.md"}}),{c(){M=p("meta"),k=a(),f=p("p"),$=a(),d(o.$$.fragment),v=a(),c=p("p"),c.innerHTML=X,H=a(),y=p("p"),y.innerHTML=O,N=a(),U=p("p"),U.innerHTML=q,Z=a(),w=p("p"),w.textContent=D,_=a(),d(T.$$.fragment),G=a(),h=p("p"),h.textContent=K,F=a(),d(C.$$.fragment),Q=a(),J=p("p"),J.innerHTML=ss,R=a(),m=p("p"),m.textContent=ts,V=a(),j=p("ul"),j.innerHTML=ls,x=a(),d(u.$$.fragment),z=a(),d(I.$$.fragment),Y=a(),g=p("p"),this.h()},l(s){const t=os("svelte-u9bgzb",document.head);M=i(t,"META",{name:!0,content:!0}),t.forEach(l),k=n(s),f=i(s,"P",{}),es(f).forEach(l),$=n(s),A(o.$$.fragment,s),v=n(s),c=i(s,"P",{"data-svelte-h":!0}),r(c)!=="svelte-16blk11"&&(c.innerHTML=X),H=n(s),y=i(s,"P",{"data-svelte-h":!0}),r(y)!=="svelte-1vm6kj5"&&(y.innerHTML=O),N=n(s),U=i(s,"P",{"data-svelte-h":!0}),r(U)!=="svelte-1pgpyfw"&&(U.innerHTML=q),Z=n(s),w=i(s,"P",{"data-svelte-h":!0}),r(w)!=="svelte-1qp9353"&&(w.textContent=D),_=n(s),A(T.$$.fragment,s),G=n(s),h=i(s,"P",{"data-svelte-h":!0}),r(h)!=="svelte-1l2mhji"&&(h.textContent=K),F=n(s),A(C.$$.fragment,s),Q=n(s),J=i(s,"P",{"data-svelte-h":!0}),r(J)!=="svelte-fl6z03"&&(J.innerHTML=ss),R=n(s),m=i(s,"P",{"data-svelte-h":!0}),r(m)!=="svelte-hkpfxv"&&(m.textContent=ts),V=n(s),j=i(s,"UL",{"data-svelte-h":!0}),r(j)!=="svelte-1clnr9e"&&(j.innerHTML=ls),x=n(s),A(u.$$.fragment,s),z=n(s),A(I.$$.fragment,s),Y=n(s),g=i(s,"P",{}),es(g).forEach(l),this.h()},h(){as(M,"name","hf:doc:metadata"),as(M,"content",Ts)},m(s,t){cs(document.head,M),e(s,k,t),e(s,f,t),e(s,$,t),b(o,s,t),e(s,v,t),e(s,c,t),e(s,H,t),e(s,y,t),e(s,N,t),e(s,U,t),e(s,Z,t),e(s,w,t),e(s,_,t),b(T,s,t),e(s,G,t),e(s,h,t),e(s,F,t),b(C,s,t),e(s,Q,t),e(s,J,t),e(s,R,t),e(s,m,t),e(s,V,t),e(s,j,t),e(s,x,t),b(u,s,t),e(s,z,t),b(I,s,t),e(s,Y,t),e(s,g,t),L=!0},p:ps,i(s){L||(B(o.$$.fragment,s),B(T.$$.fragment,s),B(C.$$.fragment,s),B(u.$$.fragment,s),B(I.$$.fragment,s),L=!0)},o(s){E(o.$$.fragment,s),E(T.$$.fragment,s),E(C.$$.fragment,s),E(u.$$.fragment,s),E(I.$$.fragment,s),L=!1},d(s){s&&(l(k),l(f),l($),l(v),l(c),l(H),l(y),l(N),l(U),l(Z),l(w),l(_),l(G),l(h),l(F),l(Q),l(J),l(R),l(m),l(V),l(j),l(x),l(z),l(Y),l(g)),l(M),S(o,s),S(T,s),S(C,s),S(u,s),S(I,s)}}}const Ts='{"title":"Managing Spaces with CircleCI Workflows","local":"managing-spaces-with-circleci-workflows","sections":[],"depth":1}';function hs(W){return is(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class us extends Ms{constructor(M){super(),rs(this,M,hs,ws,ns,{})}}export{us as component};
