Add optional bundle input

pull/76/head
Carl Törnqvist 2 years ago
parent aeb0d936a7
commit 4948de116c
No known key found for this signature in database
GPG Key ID: F4C21919B6413B12

@ -29,6 +29,9 @@ inputs:
description: "The version of Wrangler to use" description: "The version of Wrangler to use"
required: false required: false
default: "2" default: "2"
bundle:
description: "Whether to run bundling on `_worker.js` before deploying"
required: false
runs: runs:
using: "node16" using: "node16"
main: "index.js" main: "index.js"

@ -2071,7 +2071,7 @@ var require_core = __commonJS({
return inputs.map((input) => input.trim()); return inputs.map((input) => input.trim());
} }
exports.getMultilineInput = getMultilineInput; exports.getMultilineInput = getMultilineInput;
function getBooleanInput(name, options) { function getBooleanInput2(name, options) {
const trueValue = ["true", "True", "TRUE"]; const trueValue = ["true", "True", "TRUE"];
const falseValue = ["false", "False", "FALSE"]; const falseValue = ["false", "False", "FALSE"];
const val = getInput2(name, options); const val = getInput2(name, options);
@ -2082,7 +2082,7 @@ var require_core = __commonJS({
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name} throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}
Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
} }
exports.getBooleanInput = getBooleanInput; exports.getBooleanInput = getBooleanInput2;
function setOutput2(name, value) { function setOutput2(name, value) {
const filePath = process.env["GITHUB_OUTPUT"] || ""; const filePath = process.env["GITHUB_OUTPUT"] || "";
if (filePath) { if (filePath) {
@ -22070,6 +22070,7 @@ try {
const branch = (0, import_core.getInput)("branch", { required: false }); const branch = (0, import_core.getInput)("branch", { required: false });
const workingDirectory = (0, import_core.getInput)("workingDirectory", { required: false }); const workingDirectory = (0, import_core.getInput)("workingDirectory", { required: false });
const wranglerVersion = (0, import_core.getInput)("wranglerVersion", { required: false }); const wranglerVersion = (0, import_core.getInput)("wranglerVersion", { required: false });
const bundle = (0, import_core.getBooleanInput)("bundle", { required: false });
const getProject = async () => { const getProject = async () => {
const response = await (0, import_undici.fetch)( const response = await (0, import_undici.fetch)(
`https://api.cloudflare.com/client/v4/accounts/${accountId}/pages/projects/${projectName}`, `https://api.cloudflare.com/client/v4/accounts/${accountId}/pages/projects/${projectName}`,
@ -22093,8 +22094,8 @@ try {
if ${accountId} { if ${accountId} {
$ export CLOUDFLARE_ACCOUNT_ID="${accountId}" $ export CLOUDFLARE_ACCOUNT_ID="${accountId}"
} }
$$ npx wrangler@${wranglerVersion} pages publish "${directory}" --project-name="${projectName}" --branch="${branch}" $$ npx wrangler@${wranglerVersion} pages publish "${directory}" --project-name="${projectName}" --branch="${branch}" ${bundle ? "" : "--no-bundle"}
`; `;
const response = await (0, import_undici.fetch)( const response = await (0, import_undici.fetch)(
`https://api.cloudflare.com/client/v4/accounts/${accountId}/pages/projects/${projectName}/deployments`, `https://api.cloudflare.com/client/v4/accounts/${accountId}/pages/projects/${projectName}/deployments`,

@ -1,4 +1,4 @@
import { getInput, setOutput, setFailed, summary } from "@actions/core"; import { getInput, getBooleanInput, setOutput, setFailed, summary } from "@actions/core";
import type { Project, Deployment } from "@cloudflare/types"; import type { Project, Deployment } from "@cloudflare/types";
import { context, getOctokit } from "@actions/github"; import { context, getOctokit } from "@actions/github";
import shellac from "shellac"; import shellac from "shellac";
@ -17,6 +17,7 @@ try {
const branch = getInput("branch", { required: false }); const branch = getInput("branch", { required: false });
const workingDirectory = getInput("workingDirectory", { required: false }); const workingDirectory = getInput("workingDirectory", { required: false });
const wranglerVersion = getInput("wranglerVersion", { required: false }); const wranglerVersion = getInput("wranglerVersion", { required: false });
const bundle = getBooleanInput("bundle", { required: false });
const getProject = async () => { const getProject = async () => {
const response = await fetch( const response = await fetch(
@ -45,8 +46,8 @@ try {
if ${accountId} { if ${accountId} {
$ export CLOUDFLARE_ACCOUNT_ID="${accountId}" $ export CLOUDFLARE_ACCOUNT_ID="${accountId}"
} }
$$ npx wrangler@${wranglerVersion} pages publish "${directory}" --project-name="${projectName}" --branch="${branch}" $$ npx wrangler@${wranglerVersion} pages publish "${directory}" --project-name="${projectName}" --branch="${branch}" ${bundle ? "" : "--no-bundle"}
`; `;
const response = await fetch( const response = await fetch(

Loading…
Cancel
Save