Prepare repository
- Fork this repository to your GitHub account.
- Clone your forked repository to your local development environment.
Prepare Cloudflare page project
-
Head to the Workers and Pages
hello and press theCreate
button. -
Choose the
Pages
and press theUpload assets
button. -
Name your project and press the
Create project
button.Note: You don’t need to upload any assets here, just create the project.
Prepare Cloudflare API token and account ID
Cloudflare account ID
- Head back to the Workers and Pages Overview
hello . You can find your account ID on theAccount details
section.
Cloudflare API token
-
And then click on the
Manage API Tokens
below theAccount ID
. Then click on theCreate Token
button. -
If you don’t want to overthink about the permissions, you can simply choose the
Edit Cloudflare Workers
template. -
And do this if you don’t want to overthink about it also, it’s must be fine. Then press the
Continue to summary
>Create Token
button. -
You can see your API token in this moment.
Set up GitHub workflow
-
Head to the
Settings
tab of your forked repository and click on theSecurity
>Secrets and variables
>Actions
-
Add the following secrets by clicking on the
New repository secret
button.CLOUDFLARE_ACCOUNT_ID
: The Cloudflare account ID you’ve found.CLOUDFLARE_API_TOKEN
: The Cloudflare API token you’ve created.
-
Add the following variables by clicking on the
New repository variable
button in theVariables
tab.PROJECT_NAME
: The name of your Cloudflare project.SITE_URL
: The URL of your site. (if you have a custom domain, you can use it, otherwise you can use the one that Cloudflare provides you.)SITE_TITLE
: The title of your site.SITE_DESCRIPTION
: The description of your site.SITE_LANG
: The language of your site. (e.g.en
,zh-TW
)