@@ -91666,22 +91666,20 @@ module.exports.setGracefulCleanup = setGracefulCleanup;
9166691666 * See the License for the specific language governing permissions and
9166791667 * limitations under the License.
9166891668 */
91669- // Set up Google Application Credentials for use by the Firebase CLI
91670- // https://cloud.google.com/docs/authentication/production#finding_credentials_automatically
91671- async function createGacFile(googleApplicationCredentials ) {
91669+ // creates file with GAC info if parameter is not already a path to a file
91670+ // NOTE: no validation of the credential information is performed
91671+ async function createGacFile(gacInfo ) {
9167291672 try {
91673- if (fs.existsSync(googleApplicationCredentials )) {
91674- return googleApplicationCredentials ;
91673+ if (fs.existsSync(gacInfo )) {
91674+ return gacInfo ;
9167591675 }
9167691676 } catch (e) {
91677- console.log("debug: failed checking file existence with error %O", e);
91678- // googleApplicationCredentials is not a path to a file
91677+ console.warn("unexpected error while validing GAC info. Interpreting provided info as credentials data.");
9167991678 }
91680-
9168191679 const tmpFile = tmp.fileSync({
9168291680 postfix: ".json"
9168391681 });
91684- fs.writeSync(tmpFile.fd, googleApplicationCredentials );
91682+ fs.writeSync(tmpFile.fd, gacInfo );
9168591683 return tmpFile.name;
9168691684}
9168791685
@@ -93170,7 +93168,7 @@ const target = core.getInput("target");
9317093168const firebaseToolsVersion = core.getInput("firebaseToolsVersion");
9317193169async function run() {
9317293170 try {
93173- core.startGroup("Verifying firebase.json exists ");
93171+ core.startGroup("Verifying setup parameters ");
9317493172 if (entryPoint !== ".") {
9317593173 console.log(`Changing to directory: ${entryPoint}`);
9317693174 try {
@@ -93184,13 +93182,9 @@ async function run() {
9318493182 } else {
9318593183 console.warn("firebase.json file not found. If your firebase.json file is not in the root of your repo, edit the entryPoint option of this GitHub action.");
9318693184 }
93187- core.endGroup();
93188- core.startGroup("Setting up CLI credentials");
93189- console.log("validating passed credentials: %s", googleApplicationCredentials);
9319093185 const gacFilename = await createGacFile(googleApplicationCredentials);
93191- console.log("generated credentials: %s", gacFilename);
9319293186 if (gacFilename !== googleApplicationCredentials) {
93193- console.log("Created a temporary file with Application Default Credentials.");
93187+ console.log("Created a temporary file with Google Application Credentials.");
9319493188 }
9319593189 core.endGroup();
9319693190 if (configuredChannelId === "live") {
@@ -93203,6 +93197,10 @@ async function run() {
9320393197 await deployToPreviewChannel(gacFilename, channelId);
9320493198 core.endGroup();
9320593199 }
93200+ // cleanup
93201+ if (gacFilename !== googleApplicationCredentials) {
93202+ fs.unlinkSync(gacFilename);
93203+ }
9320693204 } catch (e) {
9320793205 core.setFailed(e.message);
9320893206 }
0 commit comments