Skip to content

feat: build and deploy as a cloudflare worker - #462

Open
Chew wants to merge 5 commits into
RetroAchievements:mainfrom
Chew:feat/wrangler
Open

Chew wants to merge 5 commits into
RetroAchievements:mainfrom
Chew:feat/wrangler

Conversation

@Chew

@Chew Chew commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

This PR adds a wrangler.jsonc file to deploy to Cloudflare. Cloudflare encourages all worker configuration to keep them in sync, so it's consistent. Large diff is, unsurprisingly, mostly package-lock.json.

The config is quite simple, this is a static site, so we don't need any server entrypoint file. As a result, it's completely free.

This also enables building on actions, instead of Cloudflare building it. Cloudflare's builder has no fetch depth, and forcing it to do a full pull is annoying. We get full control over how it builds with GitHub Actions, hence why I very explicitly specify full depth (ironically says 0, but it means full!) in the checkout stage.

Evidently this also bumps minimum node to specifically 22.12. 20 was EOL anyway, so this shouldn't affect anything.

Testing this PR, setting up for merge:

  1. Check out this PR, whether with gh or however you want.
  2. npm i to install wrangler.
  3. Build as you would with npm run build
  4. Check how it looks on workers with npx wrangler dev, this is what the workers will look like, and is different from npm run dev (powered by Vitepress)
  5. Run npm run deploy, this will create a Worker on Cloudflare, you may need to select the RetroAchievements organization.
  6. Head to https://dash.cloudflare.com/?to=/:account/workers/services/view/ra-docs/production/settings#builds, the project is named ra-docs so this should work once you select the account.
  7. Optionally check how it looks, there's a Visit button the top right of this page. Should match how it showed in step 4.

If we decide to deploy with GitHub, continue on. Also under this section is a way to connect to Git instead.

  1. Under build, Create Token by the "API token for external CI/CD" button, this allows you to create a token specifically for this worker.
  2. Head to repository secrets https://github.com/RetroAchievements/docs/settings/secrets/actions
  3. Add "CLOUDFLARE_API_TOKEN" with the token listed, and add "CLOUDFLARE_ACCOUNT_ID" with the account ID listed.

If all this is good, once merged, it should just build and deploy automatically.

I followed these steps, and this is what my site looks like: https://ra-docs.chew.workers.dev. Notice how the Git history shows under all the pages.

@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] No blocking issue remains; the declared Node minimum still needs a small correction.

Summary

Adds Cloudflare static-site deployment through GitHub Actions.

  • Pushes to main build the docs and publish them to Cloudflare.

Reviews (2) · Last reviewed commit: "address review" · Reviewed by Greptile

Comment thread wrangler.jsonc Resolved
Comment thread .github/workflows/deploy.yml Resolved
Comment thread package.json Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant