13

We plan to host a fairly large set of static files with Firebase Hosting. Is it possible to deploy only new files to Firebase Hosting, without having the entire site available?

We essentially want to do an "update" deploy, not a "full" deploy. We want to add files.

The context: on every Travis build, we generate new docs, and want to add those docs to our site. We don't have the entire site available at that point, only the newly generated files.

Thanks!

Seth Ladd
  • 112,095
  • 66
  • 196
  • 279
  • See https://firebase.google.com/docs/reference/hosting/rest/v1beta1/sites.versions/populateFiles for documentation on how to use the API to add (or remove) files to a version. AFAIK, as of 9 Oct 2020 there's no CLI support for this. – James Moore Oct 09 '20 at 16:30

1 Answers1

6

At the moment running firebase deploy will redeploy the entire site. There is no way to deploy only a specific part of the site or only the items that were changed/added.


Update: since mid 2018 the Firebase CLI will only deploy files that don't yet exist on the Firebase Hosting servers. This means that if you only update (or add) a single file, that's (likely) the only file that will be sent to the server when you run firebase deploy.

This so-called "delta deploy" is made possible by a new REST API for Firebase Hosting. With this it is for example possible to deploy a single file, even if you don't have a full copy of the site on your dev machine. For an example of this, see Firebase Hosting Deploy Single File.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • In Oct 2020, this answer might be a bit out of date. If you look at the api documentation, deploy is is a multi-step process. zip the files, calculate a checksum for each file, upload the set of {path-to-file: checksum} pairs. The response is a list of files that should be uploaded - so you upload just those. To delete a file, pass a {path-to-file: ""} pair with a missing checksum. "will only deploy files that don't yet exist" IMHO now is "will only deploy files with different checksums". https://firebase.google.com/docs/reference/hosting/rest/v1beta1/sites.versions/populateFiles – James Moore Oct 09 '20 at 16:44
  • Hey James, that's what I tried to explain in my mid 2018 update. Thanks for clarifying. – Frank van Puffelen Oct 09 '20 at 18:00