Skip to content

Commit

Permalink
add debug option
Browse files Browse the repository at this point in the history
  • Loading branch information
leoortizz committed Dec 6, 2023
1 parent 120e124 commit 81d3378
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type DeployConfig = {
target?: string;
// Optional version specification for firebase-tools. Defaults to `latest`.
firebaseToolsVersion?: string;
debug?: boolean;
};

export type ChannelDeployConfig = DeployConfig & {
Expand All @@ -70,8 +71,8 @@ export function interpretChannelDeployResult(

async function execWithCredentials(
args: string[],
projectId,
gacFilename,
projectId: string,
gacFilename: string,
opts: { debug?: boolean; firebaseToolsVersion?: string }
) {
let deployOutputBuf: Buffer[] = [];
Expand Down Expand Up @@ -127,7 +128,7 @@ export async function deployPreview(
gacFilename: string,
deployConfig: ChannelDeployConfig
) {
const { projectId, channelId, target, expires, firebaseToolsVersion } =
const { projectId, channelId, target, expires, firebaseToolsVersion, debug } =
deployConfig;

const deploymentText = await execWithCredentials(
Expand All @@ -139,7 +140,7 @@ export async function deployPreview(
],
projectId,
gacFilename,
{ firebaseToolsVersion }
{ firebaseToolsVersion, debug }
);

const deploymentResult = JSON.parse(deploymentText.trim()) as
Expand All @@ -150,16 +151,17 @@ export async function deployPreview(
}

export async function deployProductionSite(
gacFilename,
gacFilename: string,
productionDeployConfig: ProductionDeployConfig
) {
const { projectId, target, firebaseToolsVersion } = productionDeployConfig;
const { projectId, target, firebaseToolsVersion, debug } =
productionDeployConfig;

const deploymentText = await execWithCredentials(
["deploy", "--only", `hosting${target ? ":" + target : ""}`],
projectId,
gacFilename,
{ firebaseToolsVersion }
{ firebaseToolsVersion, debug }
);

const deploymentResult = JSON.parse(deploymentText) as
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import {
endGroup,
getBooleanInput,
getInput,
setFailed,
setOutput,
Expand Down Expand Up @@ -50,6 +51,7 @@ const octokit = token ? getOctokit(token) : undefined;
const entryPoint = getInput("entryPoint");
const target = getInput("target");
const firebaseToolsVersion = getInput("firebaseToolsVersion");
const debug = getBooleanInput("debug");

async function run() {
const isPullRequest = !!context.payload.pull_request;
Expand Down Expand Up @@ -93,6 +95,7 @@ async function run() {
projectId,
target,
firebaseToolsVersion,
debug,
});
if (deployment.status === "error") {
throw Error((deployment as ErrorResult).error);
Expand Down Expand Up @@ -121,6 +124,7 @@ async function run() {
channelId,
target,
firebaseToolsVersion,
debug,
});

if (deployment.status === "error") {
Expand Down

0 comments on commit 81d3378

Please sign in to comment.