Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

firebase deploy: how to modify pre-deploy

I have a small front-end project with javascript running on firebase hosting and I have to call the build script manually before every time I run firebase deploy. So I was looking for a way to put it in a pre-deploy script but there's no such thing in firebase CLI documentation. So anyone has any idea how to make it done?

like image 999
Hank Phung Avatar asked Feb 27 '18 07:02

Hank Phung


People also ask

What script should be run before every deploy Firebase?

The firebase. json file is required to deploy assets with the Firebase CLI because it specifies which files and settings from your project directory are deployed to your Firebase project.

How do I change changes in Firebase Hosting?

You cannot change hosted files in the Firebase Console. Instead, you should change the index. html on your local copy where you initially ran the firebase deploy command. Once you're done with the changes, run firebase deploy again to push the updated version of your website to Firebase Hosting.

How do I update Firebase project?

If you are already signed in to the new Firebase Console with the same Google account as you used on firebase.com , then you should see your firebase.com project listed under "Projects currently at Firebase.com". Follow the instructions on the new Firebase upgrade page for Web, Android or iOS.

How do you un deploy Firebase?

Go to Firebase Console and select Hosting from the menu of the left. actions like Deployed, disabled, etc. menu will be available for you to choose the action to delete the deployment.


2 Answers

Predeploy supports in latest Firebase CLI, please update your CLI and create predeploy in firebase.json file.

"hosting": {
  "predeploy": "npm run build",
  "public": "build",
like image 124
Googlian Avatar answered Oct 17 '22 06:10

Googlian


There is documentation for predeploy hooks with the Firebase CLI.

For any of the assets you can deploy—hosting, functions, database, storage, and firestore— you can add predeploy and postdeploy hooks in firebase.json, and your scripts will run with the corresponding deployment command. Both predeploy and postdeploy hooks print the standard output and error streams of the scripts to the terminal.

For example:

 {
   "hosting":{
     "postdeploy":"./messageSlack.sh 'Just deployed to Firebase Hosting'",
     "public":"public"
   }
 }
like image 24
Doug Stevenson Avatar answered Oct 17 '22 06:10

Doug Stevenson