Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 39c2b5a122 |
+2
-6
@@ -51,9 +51,5 @@ outputs:
|
||||
description: "The error output of the Wrangler command (comes from stderr)"
|
||||
deployment-url:
|
||||
description: "If the command was a Workers or Pages deployment, this will be the URL of the deployment"
|
||||
pages-deployment-alias-url:
|
||||
description: "If the command was a Pages deployment, this will be the URL of the deployment alias (if it exists) - needs wrangler >= 3.78.0"
|
||||
pages-deployment-id:
|
||||
description: "If the command was a Pages deployment, this will be the ID of the deployment - needs wrangler >= 3.81.0"
|
||||
pages-environment:
|
||||
description: "If the command was a Pages deployment, this will be the environment of the deployment - needs wrangler >= 3.81.0"
|
||||
deployment-alias-url:
|
||||
description: "If the command was a Workers or Pages deployment, this can be the URL of the deployment alias (if it exists) - needs wrangler >= 3.78.0"
|
||||
|
||||
Vendored
+23
-44
@@ -33053,10 +33053,6 @@ async function getDetailedPagesDeployOutput(artifactDirectory) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// EXTERNAL MODULE: external "path"
|
||||
var external_path_ = __nccwpck_require__(1017);
|
||||
// EXTERNAL MODULE: external "os"
|
||||
var external_os_ = __nccwpck_require__(2037);
|
||||
;// CONCATENATED MODULE: ./src/index.ts
|
||||
|
||||
|
||||
@@ -33065,8 +33061,6 @@ var external_os_ = __nccwpck_require__(2037);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const DEFAULT_WRANGLER_VERSION = "3.81.0";
|
||||
/**
|
||||
* A configuration object that contains all the inputs & immutable state for the action.
|
||||
@@ -33083,7 +33077,6 @@ const config = {
|
||||
COMMANDS: (0,core.getMultilineInput)("command"),
|
||||
QUIET_MODE: (0,core.getBooleanInput)("quiet"),
|
||||
PACKAGE_MANAGER: (0,core.getInput)("packageManager"),
|
||||
WRANGLER_OUTPUT_DIR: `${(0,external_path_.join)((0,external_os_.tmpdir)(), `wranglerArtifacts-${crypto.randomUUID()}`)}`,
|
||||
};
|
||||
const packageManager = getPackageManager(config.PACKAGE_MANAGER, {
|
||||
workingDirectory: config.workingDirectory,
|
||||
@@ -33271,22 +33264,6 @@ async function uploadSecrets() {
|
||||
endGroup();
|
||||
}
|
||||
}
|
||||
// fallback to trying to extract the deployment-url and pages-deployment-alias-url from stdout for wranglerVersion < 3.81.0
|
||||
function extractDeploymentUrlsFromStdout(stdOut) {
|
||||
let deploymentUrl = "";
|
||||
let aliasUrl = "";
|
||||
// Try to extract the deployment URL
|
||||
const deploymentUrlMatch = stdOut.match(/https?:\/\/[a-zA-Z0-9-./]+/);
|
||||
if (deploymentUrlMatch && deploymentUrlMatch[0]) {
|
||||
deploymentUrl = deploymentUrlMatch[0].trim();
|
||||
}
|
||||
// And also try to extract the alias URL (since wrangler@3.78.0)
|
||||
const aliasUrlMatch = stdOut.match(/alias URL: (https?:\/\/[a-zA-Z0-9-./]+)/);
|
||||
if (aliasUrlMatch && aliasUrlMatch[1]) {
|
||||
aliasUrl = aliasUrlMatch[1].trim();
|
||||
}
|
||||
return { deploymentUrl, aliasUrl };
|
||||
}
|
||||
async function wranglerCommands() {
|
||||
startGroup("🚀 Running Wrangler Commands");
|
||||
try {
|
||||
@@ -33315,8 +33292,9 @@ async function wranglerCommands() {
|
||||
// Used for saving the wrangler output
|
||||
let stdOut = "";
|
||||
let stdErr = "";
|
||||
// set WRANGLER_OUTPUT_FILE_DIRECTORY env for exec
|
||||
process.env.WRANGLER_OUTPUT_FILE_DIRECTORY = config.WRANGLER_OUTPUT_DIR;
|
||||
// Construct the options for the exec command
|
||||
const wranglerOutputDir = "/opt/wranglerArtifacts";
|
||||
process.env.WRANGLER_OUTPUT_FILE_DIRECTORY = wranglerOutputDir;
|
||||
const options = {
|
||||
cwd: config["workingDirectory"],
|
||||
silent: config["QUIET_MODE"],
|
||||
@@ -33336,32 +33314,33 @@ async function wranglerCommands() {
|
||||
(0,core.setOutput)("command-stderr", stdErr);
|
||||
// Check if this command is a workers deployment
|
||||
if (command.startsWith("deploy") || command.startsWith("publish")) {
|
||||
const { deploymentUrl, aliasUrl } = extractDeploymentUrlsFromStdout(stdOut);
|
||||
(0,core.setOutput)("deployment-url", deploymentUrl);
|
||||
// DEPRECATED: deployment-alias-url in favour of pages-deployment-alias, drop in next wrangler-action major version change
|
||||
(0,core.setOutput)("deployment-alias-url", aliasUrl);
|
||||
(0,core.setOutput)("pages-deployment-alias-url", aliasUrl);
|
||||
// Try to extract the deployment URL
|
||||
let deploymentUrl = "";
|
||||
const deploymentUrlMatch = stdOut.match(/https?:\/\/[a-zA-Z0-9-./]+/);
|
||||
if (deploymentUrlMatch && deploymentUrlMatch[0]) {
|
||||
deploymentUrl = deploymentUrlMatch[0].trim();
|
||||
(0,core.setOutput)("deployment-url", deploymentUrl);
|
||||
}
|
||||
// And also try to extract the alias URL (since wrangler@3.78.0)
|
||||
const aliasUrlMatch = stdOut.match(/alias URL: (https?:\/\/[a-zA-Z0-9-./]+)/);
|
||||
if (aliasUrlMatch && aliasUrlMatch.length == 2 && aliasUrlMatch[1]) {
|
||||
const aliasUrl = aliasUrlMatch[1].trim();
|
||||
(0,core.setOutput)("deployment-alias-url", aliasUrl);
|
||||
}
|
||||
}
|
||||
// Check if this command is a pages deployment
|
||||
if (command.startsWith("pages publish") ||
|
||||
command.startsWith("pages deploy")) {
|
||||
const pagesArtifactFields = await getDetailedPagesDeployOutput(config.WRANGLER_OUTPUT_DIR);
|
||||
const pagesArtifactFields = await getDetailedPagesDeployOutput(wranglerOutputDir);
|
||||
if (pagesArtifactFields) {
|
||||
(0,core.setOutput)("deployment-url", pagesArtifactFields.url);
|
||||
// DEPRECATED: deployment-alias-url in favour of pages-deployment-alias, drop in next wrangler-action major version change
|
||||
(0,core.setOutput)("deployment-alias-url", pagesArtifactFields.alias);
|
||||
(0,core.setOutput)("pages-deployment-alias-url", pagesArtifactFields.alias);
|
||||
(0,core.setOutput)("pages-deployment-id", pagesArtifactFields.deployment_id);
|
||||
(0,core.setOutput)("pages-environment", pagesArtifactFields.environment);
|
||||
(0,core.setOutput)("id", pagesArtifactFields.deployment_id);
|
||||
(0,core.setOutput)("url", pagesArtifactFields.url);
|
||||
// To ensure parity with pages-action, display url for alias if there is no alias
|
||||
(0,core.setOutput)("alias", pagesArtifactFields.alias);
|
||||
(0,core.setOutput)("environment", pagesArtifactFields.environment);
|
||||
}
|
||||
else {
|
||||
info("Unable to find a WRANGLER_OUTPUT_DIR, environment and id fields will be unavailable for output. Have you updated wrangler to version >=3.81.0?");
|
||||
// DEPRECATED: deployment-alias-url in favour of pages-deployment-alias, drop in next wrangler-action major version change
|
||||
const { deploymentUrl, aliasUrl } = extractDeploymentUrlsFromStdout(stdOut);
|
||||
(0,core.setOutput)("deployment-url", deploymentUrl);
|
||||
// DEPRECATED: deployment-alias-url in favour of pages-deployment-alias, drop in next wrangler-action major version change
|
||||
(0,core.setOutput)("deployment-alias-url", aliasUrl);
|
||||
(0,core.setOutput)("pages-deployment-alias-url", aliasUrl);
|
||||
info("No fields available for output. Have you updated wrangler to version >=3.81.0?");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user