@@ -47,6 +47,8 @@ This Action:
4747 - ` message ` : The final rendered message.
4848 - ` tag ` : The final rendered tag (if any).
4949- ` only_upload ` mode when you want to upload a version and deploy it separately.
50+ - ` wrangler_command ` lets you control exactly how Wrangler is invoked (e.g. ` wrangler ` , ` npx wrangler@4 ` , ` pnpm dlx wrangler@4 ` ).
51+ - ` working_directory ` lets you target a specific folder in a monorepo when running Wrangler commands.
5052
5153## How it works
5254
@@ -88,11 +90,13 @@ This upload-then-deploy flow is what enables meaningful messages to show up in C
8890You must:
8991
9092- Use Wrangler v4 (Versions API support required).
91- - Ensure ` wrangler ` is available in your GitHub Actions runner:
92- - Example:
93- - ` pnpm dlx wrangler@4 --version `
94- - or ` npx wrangler@4 --version `
95- - or add Wrangler v4 as a dev dependency and use it from PATH.
93+ - Ensure you have a reliable way to invoke Wrangler v4:
94+ - - You specify this explicitly via the ` wrangler_command ` input.
95+ - - Examples:
96+ - - ` wrangler `
97+ - - ` npx wrangler@4 `
98+ - - ` pnpm dlx wrangler@4 `
99+ - - No separate install step is required if your ` wrangler_command ` handles it.
96100- Provide a Cloudflare API token:
97101 - With appropriate permissions for your Worker.
98102 - Passed via ` secrets ` to the ` api_token ` input.
@@ -117,6 +121,27 @@ All inputs are strings (as per GitHub Actions) unless noted; booleans are passed
117121 - Recommended: ` secrets.CLOUDFLARE_API_TOKEN ` .
118122 - Used to set ` CLOUDFLARE_API_TOKEN ` for the Wrangler commands.
119123
124+ - ` wrangler_command ` (required)
125+ - How to invoke Wrangler.
126+ - This is the base command (and optional leading arguments) that will be used for both upload and deploy.
127+ - Examples:
128+ - ` wrangler `
129+ - ` npx wrangler@4 `
130+ - ` pnpm dlx wrangler@4 `
131+ - The Action splits this into:
132+ - Executable: first token
133+ - Base args: remaining tokens
134+ - Then runs:
135+ - ` <wrangler_command> versions upload ... `
136+ - ` <wrangler_command> versions deploy ... `
137+
138+ - ` working_directory ` (optional)
139+ - Working directory from which Wrangler commands will be executed.
140+ - If set, it is used as the ` cwd ` for both:
141+ - ` versions upload `
142+ - ` versions deploy `
143+ - Useful for monorepos where your Worker lives in a subfolder.
144+
120145- ` config ` (required)
121146 - Path to the Wrangler configuration file.
122147 - Passed as:
@@ -241,6 +266,7 @@ jobs:
241266 uses : your-org/wrangler-version-deploy-action-with-metadata@v1
242267 with :
243268 api_token : ${{ secrets.CLOUDFLARE_API_TOKEN }}
269+ wrangler_command : " pnpm dlx wrangler@4"
244270 config : " dist/server/wrangler.json"
245271 upload_args : " --env production"
246272 deploy_args : " --env production"
@@ -279,6 +305,7 @@ jobs:
279305 uses: your-org/wrangler-version-deploy-action-with-metadata@v1
280306 with:
281307 api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
308+ wrangler_command: "pnpm dlx wrangler@4"
282309 config: "wrangler.toml"
283310 upload_args: "--env staging"
284311 only_upload: "true"
@@ -327,7 +354,7 @@ You can combine outputs with other Actions to post deployment info back to PRs:
327354 });
328355```
329356+
330- + ### Example 4: Monorepo - Deploy Only When a Folder Changes
357+ ### Example 4: Monorepo - Deploy Only When a Folder Changes
331358+
332359+In a monorepo, you often want to:
333360+
@@ -365,16 +392,18 @@ You can combine outputs with other Actions to post deployment info back to PRs:
365392+
366393+ - run: pnpm dlx wrangler@4 --version
367394+
368- + - name: Upload + deploy worker-app via Versions API with metadata
369- + id: cf_deploy
370- + uses: your-org/wrangler-version-deploy-action-with-metadata@v1
371- + with:
372- + api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
373- + config: "apps/worker-app/wrangler.toml"
374- + upload_args: "--env production"
375- + deploy_args: "--env production"
376- + message_template: "worker-app: {{repo}}@{{short_sha}} on {{branch}} (run {{run_number}})"
377- +```
395+ - name: Upload + deploy worker-app via Versions API with metadata
396+ id: cf_deploy
397+ uses: your-org/wrangler-version-deploy-action-with-metadata@v1
398+ with:
399+ api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
400+ wrangler_command: "pnpm dlx wrangler@4"
401+ working_directory: "apps/worker-app"
402+ config: "wrangler.toml"
403+ upload_args: "--env production"
404+ deploy_args: "--env production"
405+ message_template: "worker-app: {{repo}}@{{short_sha}} on {{branch}} (run {{run_number}})"
406+ ```
378407
379408## Notes
380409
0 commit comments