Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions docs/getting-started/cloudflare-workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,24 +275,38 @@ Before deploying code to Cloudflare via CI, you need a Cloudflare token. You can

If it's a newly created token, select the **Edit Cloudflare Workers** template, if you already have another token, make sure the token has the corresponding permissions(No, token permissions are not shared between Cloudflare Pages and Cloudflare Workers).

then go to your GitHub repository settings dashboard: `Settings->Secrets and variables->Actions->Repository secrets`, and add a new secret with the name `CLOUDFLARE_API_TOKEN`.
Then go to your GitHub repository settings dashboard: `Settings->Secrets and variables->Actions->Repository secrets`, and add a new secret with the name `CLOUDFLARE_API_TOKEN`.

then create `.github/workflows/deploy.yml` in your Hono project root folder, paste the following code:
Don't forget to add your `account_id` to your `wrangler.toml` because the workflow will fail otherwise.

Then create `.github/workflows/deploy.yml` in your Hono project root folder, paste the following code:

```yml
name: Deploy
name: Deploy to CF Workers

on:
push:
branches:
- main
- master
workflow_dispatch: # optional for triggering manual redeploys

jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@v4
- name: Setup pnpm # use your package manager!
uses: pnpm/action-setup@v4
with:
version: latest
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22' # use your node version!
cache: 'pnpm' # use your package manager!
- name: Install dependencies
run: pnpm install --frozen-lockfile # use your package manager!
- name: Deploy
uses: cloudflare/wrangler-action@v3
with:
Expand Down