import{s as es,n as as,o as ns}from"../chunks/scheduler.d6170356.js";import{S as ps,i as Ms,g as p,s as a,r as F,A as is,h as M,f as l,c as n,j as ts,u as Q,x as o,k as ls,y as os,a as e,v as R,d as V,t as x,w as z}from"../chunks/index.fcd4cc08.js";import{C as Y}from"../chunks/CodeBlock.7b16bdef.js";import{H as rs}from"../chunks/Heading.8660bd0e.js";function cs(L){let i,g,I,d,r,A,c,P="You can keep your app in sync with your GitHub repository with a <strong>CircleCI workflow</strong>.",b,y,W='<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.',B,U,X='<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>',E,w,q="First, set up your GitHub repository and Spaces app together. Add your Spaces app as an additional remote to your existing Git repository.",S,T,k,h,O="Then force push to sync everything for the first time:",v,C,H,J,D='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.',N,j,K="In the example below:",Z,m,ss='<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>',_,u,G,f,$;return r=new rs({props:{title:"Managing Spaces with CircleCI Workflows",local:"managing-spaces-with-circleci-workflows",headingTag:"h1"}}),T=new Y({props:{code:"Z2l0JTIwcmVtb3RlJTIwYWRkJTIwc3BhY2UlMjBodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGc3BhY2VzJTJGSEZfVVNFUk5BTUUlMkZTUEFDRV9OQU1F",highlighted:"git remote add space https://huggingface.co/spaces/HF_USERNAME/SPACE_NAME",wrap:!1}}),C=new Y({props:{code:"Z2l0JTIwcHVzaCUyMC0tZm9yY2UlMjBzcGFjZSUyMG1haW4=",highlighted:"git push --force space main",wrap:!1}}),u=new Y({props:{code:"dmVyc2lvbiUzQSUyMDIuMSUwQSUwQXdvcmtmbG93cyUzQSUwQSUyMCUyMG1haW4lM0ElMEElMjAlMjAlMjAlMjBqb2JzJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwLSUyMHN5bmMtdG8taHVnZ2luZ2ZhY2UlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBjb250ZXh0JTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLSUyMEh1Z2dpbmdGYWNlJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZmlsdGVycyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGJyYW5jaGVzJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb25seSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMC0lMjBtYWluJTBBJTBBam9icyUzQSUwQSUyMCUyMHN5bmMtdG8taHVnZ2luZ2ZhY2UlM0ElMEElMjAlMjAlMjAlMjBkb2NrZXIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAtJTIwaW1hZ2UlM0ElMjBhbHBpbmUlMEElMjAlMjAlM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9UT0tFTiU3RCU0MGh1Z2dpbmdmYWNlLmNvJTJGc3BhY2VzJTJGSEZfVVNFUk5BTUUlMkZTUEFDRV9OQU1FJTIwbWFpbg==",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}}),{c(){i=p("meta"),g=a(),I=p("p"),d=a(),F(r.$$.fragment),A=a(),c=p("p"),c.innerHTML=P,b=a(),y=p("p"),y.innerHTML=W,B=a(),U=p("p"),U.innerHTML=X,E=a(),w=p("p"),w.textContent=q,S=a(),F(T.$$.fragment),k=a(),h=p("p"),h.textContent=O,v=a(),F(C.$$.fragment),H=a(),J=p("p"),J.innerHTML=D,N=a(),j=p("p"),j.textContent=K,Z=a(),m=p("ul"),m.innerHTML=ss,_=a(),F(u.$$.fragment),G=a(),f=p("p"),this.h()},l(s){const t=is("svelte-u9bgzb",document.head);i=M(t,"META",{name:!0,content:!0}),t.forEach(l),g=n(s),I=M(s,"P",{}),ts(I).forEach(l),d=n(s),Q(r.$$.fragment,s),A=n(s),c=M(s,"P",{"data-svelte-h":!0}),o(c)!=="svelte-16blk11"&&(c.innerHTML=P),b=n(s),y=M(s,"P",{"data-svelte-h":!0}),o(y)!=="svelte-1vm6kj5"&&(y.innerHTML=W),B=n(s),U=M(s,"P",{"data-svelte-h":!0}),o(U)!=="svelte-1pgpyfw"&&(U.innerHTML=X),E=n(s),w=M(s,"P",{"data-svelte-h":!0}),o(w)!=="svelte-1qp9353"&&(w.textContent=q),S=n(s),Q(T.$$.fragment,s),k=n(s),h=M(s,"P",{"data-svelte-h":!0}),o(h)!=="svelte-1l2mhji"&&(h.textContent=O),v=n(s),Q(C.$$.fragment,s),H=n(s),J=M(s,"P",{"data-svelte-h":!0}),o(J)!=="svelte-fl6z03"&&(J.innerHTML=D),N=n(s),j=M(s,"P",{"data-svelte-h":!0}),o(j)!=="svelte-hkpfxv"&&(j.textContent=K),Z=n(s),m=M(s,"UL",{"data-svelte-h":!0}),o(m)!=="svelte-1clnr9e"&&(m.innerHTML=ss),_=n(s),Q(u.$$.fragment,s),G=n(s),f=M(s,"P",{}),ts(f).forEach(l),this.h()},h(){ls(i,"name","hf:doc:metadata"),ls(i,"content",ys)},m(s,t){os(document.head,i),e(s,g,t),e(s,I,t),e(s,d,t),R(r,s,t),e(s,A,t),e(s,c,t),e(s,b,t),e(s,y,t),e(s,B,t),e(s,U,t),e(s,E,t),e(s,w,t),e(s,S,t),R(T,s,t),e(s,k,t),e(s,h,t),e(s,v,t),R(C,s,t),e(s,H,t),e(s,J,t),e(s,N,t),e(s,j,t),e(s,Z,t),e(s,m,t),e(s,_,t),R(u,s,t),e(s,G,t),e(s,f,t),$=!0},p:as,i(s){$||(V(r.$$.fragment,s),V(T.$$.fragment,s),V(C.$$.fragment,s),V(u.$$.fragment,s),$=!0)},o(s){x(r.$$.fragment,s),x(T.$$.fragment,s),x(C.$$.fragment,s),x(u.$$.fragment,s),$=!1},d(s){s&&(l(g),l(I),l(d),l(A),l(c),l(b),l(y),l(B),l(U),l(E),l(w),l(S),l(k),l(h),l(v),l(H),l(J),l(N),l(j),l(Z),l(m),l(_),l(G),l(f)),l(i),z(r,s),z(T,s),z(C,s),z(u,s)}}}const ys='{"title":"Managing Spaces with CircleCI Workflows","local":"managing-spaces-with-circleci-workflows","sections":[],"depth":1}';function Us(L){return ns(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Js extends ps{constructor(i){super(),Ms(this,i,Us,cs,es,{})}}export{Js as component};
