Skip to content

Instantly share code, notes, and snippets.

Created May 2, 2019 08:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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
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