Skip to content

Support for packageExecute parameter in yml #322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bin/action.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -92943,9 +92943,10 @@ function interpretChannelDeployResult(deployResult) {
async function execWithCredentials(args, projectId, gacFilename, opts) {
let deployOutputBuf = [];
const debug = opts.debug || false;
const packageExecute = opts.packageExecute || 'npx';
const firebaseToolsVersion = opts.firebaseToolsVersion || "latest";
try {
await exec_1.exec(`npx firebase-tools@${firebaseToolsVersion}`, [...args, ...(projectId ? ["--project", projectId] : []), debug ? "--debug" // gives a more thorough error message
await exec_1.exec(`${packageExecute} firebase-tools@${firebaseToolsVersion}`, [...args, ...(projectId ? ["--project", projectId] : []), debug ? "--debug" // gives a more thorough error message
: "--json" // allows us to easily parse the output
], {
listeners: {
Expand Down Expand Up @@ -93167,6 +93168,9 @@ async function postChannelSuccessComment(github, context, result, commit) {
* limitations under the License.
*/
// Inputs defined in action.yml
const packageExecute = core.getInput("packageExecute", {
trimWhitespace: true
});
const expires = core.getInput("expires");
const projectId = core.getInput("projectId");
const googleApplicationCredentials = core.getInput("firebaseServiceAccount", {
Expand Down Expand Up @@ -93208,6 +93212,7 @@ async function run() {
if (isProductionDeploy) {
core.startGroup("Deploying to production site");
const deployment = await deployProductionSite(gacFilename, {
packageExecute,
projectId,
target,
firebaseToolsVersion
Expand All @@ -93231,6 +93236,7 @@ async function run() {
const channelId = getChannelId(configuredChannelId, github.context);
core.startGroup(`Deploying to Firebase preview channel ${channelId}`);
const deployment = await deployPreview(gacFilename, {
packageExecute,
projectId,
expires,
channelId,
Expand Down
6 changes: 4 additions & 2 deletions src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export type ProductionSuccessResult = {
};

type DeployConfig = {
packageExecute?: string;
projectId: string;
target?: string;
// Optional version specification for firebase-tools. Defaults to `latest`.
Expand Down Expand Up @@ -72,15 +73,16 @@ async function execWithCredentials(
args: string[],
projectId,
gacFilename,
opts: { debug?: boolean; firebaseToolsVersion?: string }
opts: { debug?: boolean; firebaseToolsVersion?: string, packageExecute?: string }
) {
let deployOutputBuf: Buffer[] = [];
const debug = opts.debug || false;
const packageExecute = opts.packageExecute || 'npx';
const firebaseToolsVersion = opts.firebaseToolsVersion || "latest";

try {
await exec(
`npx firebase-tools@${firebaseToolsVersion}`,
`${packageExecute} firebase-tools@${firebaseToolsVersion}`,
[
...args,
...(projectId ? ["--project", projectId] : []),
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
} from "./postOrUpdateComment";

// Inputs defined in action.yml
const packageExecute = getInput("packageExecute", {trimWhitespace: true});
const expires = getInput("expires");
const projectId = getInput("projectId");
const googleApplicationCredentials = getInput("firebaseServiceAccount", {
Expand Down Expand Up @@ -90,6 +91,7 @@ async function run() {
if (isProductionDeploy) {
startGroup("Deploying to production site");
const deployment = await deployProductionSite(gacFilename, {
packageExecute,
projectId,
target,
firebaseToolsVersion,
Expand All @@ -116,6 +118,7 @@ async function run() {

startGroup(`Deploying to Firebase preview channel ${channelId}`);
const deployment = await deployPreview(gacFilename, {
packageExecute,
projectId,
expires,
channelId,
Expand Down