Branch Deploys on CloudFlare Workers

Hey! I’m new to CF Workers and am trying to wrap my head around a few things. Any help would be greatly appreciated!

I am working on setting up a project where we will be creating lots of microsites using 11ty. Sites are categorized by city, and we may have dozens of sites per city.

All microsites for a given city will live on a domain like city.orgName.com. So site-a would be city.orgName.com/site-a, site-b would be city.orgName.com/site-b, and so on.

I’m trying to understand if it’s possible to have this type of domain structure:

Prod: city.orgName.com
Staging Root: orgName.workers.dev
Staging for Microsite: orgName.workers.dev/site-a

Additionally, I’m trying to understand how this might work with GitHub Actions. Something my team is fairly spoiled on is the ability to push a branch to an open PR on Github and have it Zeit automatically generate a deploy preview for us. Zeit does this on a branch-level, so we get URLs like branchName.org.now.sh.

I’m hoping I can set up an action to ultimately create new deploys for each branch pushed, with a domain structure like this:

branchName.cityName.orgName.workers.dev/site-b

This is incredibly helpful for sharing preview links with stakeholders quickly.

It’s also worth mentioning that we are in a monorepo using Yarn Workspaces here, so it may not be possible to use a Github Action. Worst case, I’m fine with having to build/run a preview deploy script locally, but I’m still confused on how I can set up domain structure like this.

1 Like