Skip to content

Commit

Permalink
Revert "Add parity with pages-action for pages deploy outputs"
Browse files Browse the repository at this point in the history
This reverts commit 3ec7f89.
  • Loading branch information
Maximo-Guk committed Oct 24, 2024
1 parent c010357 commit 10d5b9c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 232 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-doors-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler-action": minor
---

Revert "Add parity with pages-action for pages deploy outputs"
27 changes: 3 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
},
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"zod": "^3.23.8"
"@actions/exec": "^1.1.1"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.8",
Expand All @@ -40,7 +39,6 @@
"@types/node": "^20.10.4",
"@vercel/ncc": "^0.38.1",
"prettier": "^3.1.0",
"mock-fs": "^5.4.0",
"semver": "^7.5.4",
"typescript": "^5.3.3",
"vitest": "^1.0.3"
Expand Down
41 changes: 11 additions & 30 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import {
debug,
getBooleanInput,
getInput,
getMultilineInput,
endGroup as originalEndGroup,
error as originalError,
info as originalInfo,
debug,
startGroup as originalStartGroup,
setFailed,
setOutput,
} from "@actions/core";
import { getExecOutput } from "@actions/exec";
import semverEq from "semver/functions/eq";
import { exec, execShell } from "./exec";
import { getPackageManager } from "./packageManagers";
import { checkWorkingDirectory, semverCompare } from "./utils";
import { getDetailedPagesDeployOutput } from "./wranglerArtifactManager";
import { getPackageManager } from "./packageManagers";

const DEFAULT_WRANGLER_VERSION = "3.81.0";
const DEFAULT_WRANGLER_VERSION = "3.78.10";

/**
* A configuration object that contains all the inputs & immutable state for the action.
Expand Down Expand Up @@ -314,9 +313,6 @@ async function wranglerCommands() {
let stdErr = "";

// 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"],
Expand All @@ -337,9 +333,14 @@ async function wranglerCommands() {
setOutput("command-output", stdOut);
setOutput("command-stderr", stdErr);

// Check if this command is a workers deployment
if (command.startsWith("deploy") || command.startsWith("publish")) {
// Try to extract the deployment URL
// Check if this command is a workers or pages deployment
if (
command.startsWith("deploy") ||
command.startsWith("publish") ||
command.startsWith("pages publish") ||
command.startsWith("pages deploy")
) {
// If this is a workers or pages deployment, try to extract the deployment URL
let deploymentUrl = "";
const deploymentUrlMatch = stdOut.match(/https?:\/\/[a-zA-Z0-9-./]+/);
if (deploymentUrlMatch && deploymentUrlMatch[0]) {
Expand All @@ -356,26 +357,6 @@ async function wranglerCommands() {
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(wranglerOutputDir);

if (pagesArtifactFields) {
setOutput("id", pagesArtifactFields.deployment_id);
setOutput("url", pagesArtifactFields.url);
// To ensure parity with pages-action, display url for alias if there is no alias
setOutput("alias", pagesArtifactFields.alias);
setOutput("environment", pagesArtifactFields.environment);
} else {
info(
"No fields available for output. Have you updated wrangler to version >=3.81.0?",
);
}
}
}
} finally {
endGroup();
Expand Down
89 changes: 0 additions & 89 deletions src/wranglerArtifactManager.test.ts

This file was deleted.

86 changes: 0 additions & 86 deletions src/wranglerArtifactManager.ts

This file was deleted.

0 comments on commit 10d5b9c

Please sign in to comment.