Skip to content

Commit 4d34407

Browse files
GregBrimblekodster28
authored andcommitted
Non-production branch builds, GitHub comments and preview URLs (#21383)
* Preview URLs * Apply suggestions from code review Co-authored-by: Kody Jackson <[email protected]> --------- Co-authored-by: Kody Jackson <[email protected]>
1 parent ef86d05 commit 4d34407

File tree

11 files changed

+90
-43
lines changed

11 files changed

+90
-43
lines changed
170 KB
Loading
127 KB
Loading

src/content/docs/workers/ci-cd/builds/advanced-setups.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pcx_content_type: reference
33
title: Advanced setups
44
description: Learn how to use Workers Builds with more advanced setups
55
sidebar:
6-
order: 7
6+
order: 8
77
---
88

99
## Monorepos
@@ -53,12 +53,12 @@ You can use [Wrangler Environments](/workers/wrangler/environments/) with Worker
5353
1. [Deploy via Wrangler](/workers/wrangler/commands/#deploy) to create the Workers for your environments on the Dashboard, if you do not already have them.
5454
2. Find the Workers for your environments. They are typically named `[name of Worker] - [environment name]`.
5555
3. Connect your repository to each of the Workers for your environment.
56-
4. In each of the Workers, edit your Wrangler deploy command to include the flag `--env: <environment name>` in the build configurations.
56+
4. In each of the Workers, edit your Wrangler commands to include the flag `--env: <environment name>` in the build configurations for both the deploy command, and the non-production branch deploy command ([if applicable](/workers/ci-cd/builds/build-branches/#configure-non-production-branch-builds)).
5757

5858
When a new commit is detected in the repository, a new build/deploy will trigger for each associated Worker.
5959

6060
### Example
6161

6262
Imagine you have a Worker named `my-worker`, and you want to set up two environments `staging` and `production` set in the `wrangler.toml`. If you have not already, you can deploy `my-worker` for each environment using the commands `wrangler deploy --env staging` and `wrangler deploy --env production`.
6363

64-
In your Cloudflare Dashboard, you should find the two Workers `my-worker-staging` and `my-worker-production`. Then, connect the Git repository for the Worker, `my-worker`, to both of the environment Workers. In the build configurations of each environment Worker, edit the deploy commands to be `npx wrangler deploy --env staging` and `npx wrangler deploy --env production` respectively.
64+
In your Cloudflare Dashboard, you should find the two Workers `my-worker-staging` and `my-worker-production`. Then, connect the Git repository for the Worker, `my-worker`, to both of the environment Workers. In the build configurations of each environment Worker, edit the deploy commands to be `npx wrangler deploy --env staging` and `npx wrangler deploy --env production` and the non-production branch deploy commands to be `npx wrangler versions upload --env staging` and `npx wrangler versions upload --env production` respectively.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
pcx_content_type: concept
3+
title: Build branches
4+
description: Configure which git branches should trigger a Workers Build
5+
sidebar:
6+
order: 6
7+
---
8+
9+
When you connect a git repository to Workers, commits made on the production git branch will produce a Workers Build. If you want to take advantage of [preview URLs](/workers/configuration/previews/) and [pull request comments](/workers/ci-cd/builds/git-integration/github-integration/#pull-request-comment), you can additionally enable "non-production branch builds" in order to trigger a build on all branches of your repository.
10+
11+
## Change production branch
12+
13+
To change the production branch of your project:
14+
15+
1. In **Overview**, select your Workers project.
16+
2. Go to **Settings** > **Build** > **Branch control**. Workers will default to the default branch of your git repository, but this can be changed in the dropdown.
17+
18+
Every push event made to this branch will trigger a build and execute the [build command](/workers/ci-cd/builds/configuration/#build-command), followed by the [deploy command](/workers/ci-cd/builds/configuration/#deploy-command).
19+
20+
## Configure non-production branch builds
21+
22+
To enable or disable non-production branch builds:
23+
24+
1. In **Overview**, select your Workers project.
25+
2. Go to **Settings** > **Build** > **Branch control**. The checkbox allows you to enable or disable builds for non-production branches.
26+
27+
When enabled, every push event made to a non-production branch will trigger a build and execute the [build command](/workers/ci-cd/builds/configuration/#build-command), follwed by the [non-production branch deploy command](/workers/ci-cd/builds/configuration/#non-production-branch-deploy-command).

src/content/docs/workers/ci-cd/builds/build-watch-paths.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pcx_content_type: concept
33
title: Build watch paths
44
description: Reduce compute for your monorepo by specifying paths for Workers Builds to skip
55
sidebar:
6-
order: 6
6+
order: 7
77
---
88

99
When you connect a git repository to Workers, by default a change to any file in the repository will trigger a build. You can configure Workers to include or exclude specific paths to specify if Workers should skip a build for a given path. This can be especially helpful if you are using a monorepo project structure and want to limit the amount of builds being kicked off.

0 commit comments

Comments
 (0)