|
| 1 | +# Deploy to Cloudflare Pages |
| 2 | + |
| 3 | +Here are the steps to deploy a GitHub repository to Cloudflare Pages. |
| 4 | + |
| 5 | +For reference, see [Cloudflare Pages GitHub Action](https://github.com/marketplace/actions/deploy-to-cloudflare-pages). |
| 6 | + |
| 7 | +Replace the placeholder `example` with your project name. (Kebab case: lowercase alphanumeric with dash `-`, no spaces.) |
| 8 | + |
| 9 | +## Repository secrets |
| 10 | + |
| 11 | +From GitHub repo's Settings -> Secrets -> Actions, add new "repository secrets". |
| 12 | + |
| 13 | +- `CLOUDFLARE_ACCOUNT_ID` |
| 14 | + - From dash.cloudflare.com, select the domain. In the Overview's right sidebar, scroll down to find **Account ID**. |
| 15 | +- `CLOUDFLARE_API_TOKEN` |
| 16 | + - From dashboard, select your user's avatar (top right) and go to Profile -> API Tokens -> Create Token. Then to Custom Token -> Get Started. |
| 17 | + - Name: `tangible-cloudflare-pages-deploy` |
| 18 | + - Under Permissions, select Account, Cloudflare Pages, and Edit. |
| 19 | + - Click Continue to Summary, and **Create Token**. |
| 20 | + |
| 21 | +## Pages project |
| 22 | + |
| 23 | +From Cloudflare dashboard, create a Pages project. |
| 24 | + |
| 25 | +- Go to Workers & Pages, click Create Application. Then Pages -> Drag and drop your files. |
| 26 | +- Name: `storybook-example`. Then Created Project - no need to Deploy Site, it will be done in the next step. |
| 27 | + |
| 28 | +## Workflow script |
| 29 | + |
| 30 | +Prepare GitHub Actions workflow script. |
| 31 | + |
| 32 | +- Create `.github/workflows/deploy-cloudflare-pages.yml` |
| 33 | +- Copy from [tangible-ui](https://github.com/TangibleInc/tangible-ui/blob/main/.github/workflows/deploy-cloudflare-pages.yml) or pipeline, and replace project-specific values: |
| 34 | + - projectName: `storybook-example` - Same as Cloudflare Pages project created above |
0 commit comments