Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Deploying the site

Michael Solati edited this page Oct 5, 2021 · 8 revisions

We use Firebase Hosting to host the site as well as Cloud Build to automatically deploy the site.

Cloud Build

The Cloud Build process is broken up into two tasks, version-check and deploy.

version-check

Every hour, Monday through Friday ('0 * * * 1-5'), version-check runs a node script that compares the current (HEAD of main) commit SHA against the commit SHA of the deployed site. If the two SHAs are different then this task will trigger the deploy task.

deploy

The deploy task builds a production version of the site to be deployed onto Firebase Hosting as well as updates the Algolia index of the site based on the new production build's content.

  1. The first step it to install all dependencies.
  2. Step two runs a script that extracts all the "secrets" from Secret Manager and turns them into a .env file, so that the build commands have all the relevant API keys.
  3. The third step is to run a production build of the website.
  4. Next, in step four, the production build of the site is deployed to Firebase using the Firebase community builder image.
  5. Finally, step five, after the site has been deployed the dist/pages.json (only produced in production builds) is read by algolia.js and then updates the data in Algolia.

Manual Deployment

To manually deploy the site you'll need to be a member of one of these Google teams:

  • web.dev-eng
  • web.dev-owners
  1. Navigate to the Cloud Build Triggers page.
  2. Click the RUN button for the trigger named Deploy.
  3. In the side drawer that opens up, click the RUN TRIGGER button for the trigger for the main branch.

NOTE: web.dev auto deploys every hour if there is a new commit in the main branch. Manual deploys should only occur when a build fails or if auto deploys are disabled.

Firebase

firebase.json

Firebase requires a firebase.json file in order to configure hosting behavior, this file is not committed to the repo but is instead dynamically generated. The base for this config can be found in firebase.incl.json, any changes you'd want to make should be made there. All of the redirects are maintained in redirects.yaml, and redirects you'd want to add should be added there.

When you run npm run build or npm run dev the firebase.json file is generated by the firebase-config.js and then Firebase Hosting for either local development or for a deployment will work.

Clone this wiki locally