Deploy via GitHub Actions
Notice
Currently only supports Worker and Pages deployment. If you encounter any issues, please report them via GitHub Issues. Thank you.
The worker.dev domain is inaccessible in China, please use a custom domain
Deployment Steps
Fork Repository and Enable Actions
- Fork this repository on GitHub
- Open the
Actionspage of the repository - Find
Deploy Backendand clickenable workflowto enable theworkflow - If you need separate frontend and backend deployment that talks to Worker directly, find
Deploy Frontendand clickenable workflowto enable theworkflow - If you need Pages deployment with Page Functions forwarding backend requests, find
Deploy Frontend with page functionand clickenable workflowto enable theworkflow
Configure Secrets
Then go to the repository page Settings -> Secrets and variables -> Actions -> Repository secrets, and add the following secrets:
Common
secretsName Description CLOUDFLARE_ACCOUNT_IDCloudflare Account ID, Reference Documentation CLOUDFLARE_API_TOKENCloudflare API Token, Reference Documentation Worker backend
secretsName Description BACKEND_TOMLBackend configuration file, see here DEBUG_MODE(Optional) Whether to enable debug mode, set to trueto enable. By default, worker deployment logs are not output to GitHub Actions page, enabling this will output themBACKEND_USE_MAIL_WASM_PARSER(Optional) Whether to use WASM to parse emails, set to trueto enable. For features, refer to Configure Worker to use WASM Email ParserUSE_WORKER_ASSETS(Optional) Deploy Worker with frontend assets, set to trueto enablePages frontend
secretsNotice
If you choose to deploy Worker with frontend assets, these
secretsare not requiredName Description FRONTEND_ENVFrontend configuration file used by the Deploy Frontendworkflow. Copy the content fromfrontend/.env.example, and modify it according to this guide. For separate frontend/backend deployment that talks to Worker directly,VITE_API_BASEshould be the backend Worker API root URL, must start withhttps://, and must not include a trailing/. When this address is configured incorrectly, common symptoms are themaperror or405API responsesFRONTEND_NAMEThe project name you created in Cloudflare Pages, can be created via UI or Command Line FRONTEND_BRANCH(Optional) Branch for pages deployment, can be left unconfigured, defaults to productionPAGE_TOML(Optional) Used only by the Deploy Frontend with page functionworkflow. Required when using page functions to forward backend requests. Please copy the content frompages/wrangler.tomland modify theservicefield to your worker backend name according to actual situation. This workflow builds the frontend in Pages mode and uses same-origin requests, so it does not readFRONTEND_ENVTG_FRONTEND_NAME(Optional) The project name you created in Cloudflare Pages, same as FRONTEND_NAME. Fill this in if you need Telegram Mini App functionality
Deploy
- Open the
Actionspage of the repository - Find
Deploy Backendand clickRun workflowto select a branch and deploy manually - If you need separate frontend and backend deployment that talks to Worker directly, find
Deploy Frontendand clickRun workflowto select a branch and deploy manually - If you need Pages deployment with Page Functions forwarding backend requests, find
Deploy Frontend with page functionand clickRun workflowto deploy manually
Auto-Update with Page Functions Forwarding
If you want to use Upstream Sync for automatic updates and also let Pages forward backend requests through Page Functions, use the Deploy Frontend with page function workflow instead of Deploy Frontend.
- Enable
Upstream Sync,Deploy Backend, andDeploy Frontend with page function - Configure the
PAGE_TOMLrepository secret by copying the content ofpages/wrangler.toml - Change the
servicefield inPAGE_TOMLto your Worker backend name - This workflow runs
pnpm build:pages, uses same-origin frontend requests, and does not readFRONTEND_ENV - After each completed
Upstream Sync,Deploy Frontend with page functiondeploys the frontend automatically whenPAGE_TOMLis configured
How to Configure Auto-Update
- Open the
Actionspage of the repository, findUpstream Sync, and clickenable workflowto enable theworkflow - If
Upstream Syncfails, go to the repository homepage and clickSyncto synchronize manually