Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deploy to firebase with any CI
const fs = require('fs');
const token = process.env['FIREBASE_TOKEN']; // Keep your firebase cli token in FIREBASE_TOKEN as a env param
const projectName = (JSON.parse(fs.readFileSync(`${__dirname}/.firebaserc`, 'utf8')))
.projects[process.env.NODE_ENV ? process.env.NODE_ENV : 'default'];
/**
* FireBase Deployment script
* FOR CI USE ONLY!
*/
console.log('Deploying to Firebase... please wait.');
token ? require('firebase-tools')
.deploy((() => ({project: projectName, token: token, cwd: __dirname}))())
.then(() => console.log(`Your project ${projectName} has been deployed`))
.catch((err) => console.warn(`error has occurred! - ${err}`))
: console.error('waitt...where is your firebase token?');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment