title: Upload files to Cloud Storage as a Functions deployment step
body: <p>When I build and deploy my functions, I want to run a script that also uploads a series of files to Cloud Storage. These files don't fit in the 100 MB limit for functions, so the functions will access them when needed.</p>
  <p>As far as I understand, the dynamics are fairly simple:</p>
  <ol>
  <li>Write said script with logic to detect which files need to be uploaded.</li>
  <li>Within it, initialize Firebase using the <code>firebase-admin</code> SDK and a service account key from GCP.</li>
  <li>Run this script as part of the NPM script that deploys.</li>
  </ol>
  <p>The complication comes when I try to adapt this process to nicely handle my 3 environments (modeled in 3 projects) and the emulator.</p>
  <p>For instance:</p>
  <ul>
  <li>How should I graciously detect which project to connect to within the deployment process? I tried using <code>firebase-tools</code> to at least get the current project as a module instead of a CLI tool, but it is not documented at all (or typed, for that matter).</li>
  <li>How can I connect this step to the steps the emulator follows on every internal deployment to ensure those files are also loaded in the emulated storage?</li>
  </ul>
  <p>By going outside of the standard environment and uploading stuff from my local environment I seem to lose quite a bit of the internal set up Firebase provides through its CLI, but I wonder if there's anything I might be missing here.</p>
  <p><strong>Tl;dr</strong>: I want to upload files to Storage during Functions deployment, seamlessly detecting which environment the deployment is targeting.</p>