Skip to content

Commit eb8bb17

Browse files
committed
feat: support deploy branch
1 parent b01c6e4 commit eb8bb17

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
export const onPostBuild = async function ({ inputs, constants, netlifyConfig, utils: { run, build, status } }) {
22
try {
33
const { BRANCH, CLOUDFLARE_PAGES_PROJECT_NAME } = netlifyConfig.build.environment;
4-
const command = `${inputs.package_exec} wrangler pages deploy ${constants.PUBLISH_DIR} --project-name=${CLOUDFLARE_PAGES_PROJECT_NAME} --branch=${BRANCH}`;
4+
const branch = inputs.deploy_target_branch || BRANCH;
5+
6+
const command = `${inputs.package_exec} wrangler pages deploy ${constants.PUBLISH_DIR} --project-name=${CLOUDFLARE_PAGES_PROJECT_NAME} --branch=${branch}`;
57
await run.command(command);
8+
69
status.show({
710
summary: "Deployed to Cloudflare Pages Successfully",
8-
text: `Deployed to Pages/${CLOUDFLARE_PAGES_PROJECT_NAME}/${BRANCH}`,
11+
text: `Deployed to Pages/${CLOUDFLARE_PAGES_PROJECT_NAME}/${branch}`,
912
});
1013
} catch (error) {
1114
build.failBuild("Failed while deploy your site to Cloudflare Pages", { error });

manifest.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ inputs:
44
- name: package_exec
55
description: Package exec to use Eg. `npx`, `pnpx` or install `wrangler` to devDeps and use `npm`, `yarn` and `pnpm` instead (caching support and recommended this)
66
default: npx
7+
- name: deploy_target_branch
8+
description: Cloudflare Pages deploy target branch (default is netlify build branch)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "netlify-plugin-cloudflare-pages",
3-
"version": "0.9.0",
3+
"version": "0.9.1",
44
"type": "module",
55
"author": "Thanee Charattrakool <[email protected]>",
66
"packageManager": "[email protected]",

0 commit comments

Comments
 (0)