1"use strict";(globalThis.webpackChunkopszero||=[]).push([[4903],{16621(e,t,n){n.r(t),n.d(t,{default:()=>c,metadata:()=>i});var i=n(92651),s=n(74848),a=n(28453);const o={title:"Deploying to Cloudflare Pages using Github Actions",authors:["abhiyerra"],date:new Date("2024-01-02T00:00:00.000Z")},r={authorsImageUrls:[void 0]};function l(e){const t={code:"code",h2:"h2",hr:"hr",p:"p",pre:"pre",strong:"strong",...(0,a.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(t.p,{children:["Cloudflare provides a great CDN with no egress charges on bandwidth. The best\nway to use Cloudflare is through ",(0,s.jsx)(t.strong,{children:"Cloudflare Pages"}),"."]}),"\n",(0,s.jsxs)(t.p,{children:["Using Cloudflare Pages should be pretty straightforward for most frameworks that\ngenerate a SPA. However, see the example below for how to use Cloudflare Pages\nfrom asset pipelines for ",(0,s.jsx)(t.strong,{children:"Ruby on Rails"})," and ",(0,s.jsx)(t.strong,{children:"Django"}),"."]}),"\n",(0,s.jsx)(t.hr,{}),"\n",(0,s.jsx)(t.h2,{id:"example-publish-django-static-files-with-github-actions",children:"Example: Publish Django Static Files with GitHub Actions"}),"\n",(0,s.jsxs)(t.p,{children:["Here is an example of using ",(0,s.jsx)(t.strong,{children:"GitHub Actions"})," to publish Django static files:"]}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-yaml",children:"- name: Build Static Files\n run: |\n docker run --env STATIC_ROOT='/static-compiled/' \\\n --env DATABASE_URL='sqlite:///db.sqlite' \\\n -v $PWD/static:/app/static \\\n -v $PWD/static-compiled:/static-compiled \\\n $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \\\n python manage.py collectstatic --noinput\n\n- name: Publish Static Files\n uses: cloudflare/[email protected]\n with:\n apiToken: ${{ secrets.CF_API_TOKEN }}\n accountId: ${{ secrets.CF_ACCOUNT_ID }}\n command: pages publish ./static-compiled --project-name=opszero-static --commit-dirty=true\n"})})]})}function c(e={}){const{wrapper:t}={...(0,a.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}n.d(t,["assets",0,r,"contentTitle",0,void 0,"frontMatter",0,o,"toc",0,[{value:"Example: Publish Django Static Files with GitHub Actions",id:"example-publish-django-static-files-with-github-actions",level:2}]])},28453(e,t,n){n.d(t,{R:()=>o,x:()=>r});var i=n(96540);const s={},a=i.createContext(s);function o(e){const t=i.useContext(a);return i.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function r(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),i.createElement(a.Provider,{value:t},e.children)}},92651(e){e.exports=JSON.parse('{"permalink":"/blog/2024/01/02/deploying-to-cloudflare-pages-using-github-actions","source":"@site/blog/2024-01-02-deploying-to-cloudflare-pages-using-github-actions.md","title":"Deploying to Cloudflare Pages using Github Actions","description":"Cloudflare provides a great CDN with no egress charges on bandwidth. The best","date":"2024-01-02T00:00:00.000Z","tags":[],"readingTime":0.68,"hasTruncateMarker":false,"authors":[{"name":"Abhi Yerra","title":"Founder","url":"https://opszero.com/author/abhiyerra/","page":{"permalink":"/blog/authors/abhiyerra"},"socials":{"linkedin":"https://www.linkedin.com/in/abhiyerra/","github":"https://github.com/abhiyerra"},"imageURL":"https://github.com/abhiyerra.png","key":"abhiyerra"}],"frontMatter":{"title":"Deploying to Cloudflare Pages using Github Actions","authors":["abhiyerra"],"date":"2024-01-02T00:00:00.000Z"},"unlisted":false,"prevItem":{"title":"And there is Azure coming from behind\u2026","permalink":"/blog/2024/01/02/and-there-is-azure-coming-from-behind"},"nextItem":{"title":"Django Everywhere","permalink":"/blog/2024/01/02/django-everywhere"}}')}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.