-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Deploying the site
We use Firebase Hosting to host the site as well as Cloud Build to automatically deploy the site.
The Cloud Build process is broken up into two tasks, version-check
and deploy
.
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.
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.
- The first step it to install all dependencies.
- 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. - The third step is to run a production build of the website.
- Next, in step four, the production build of the site is deployed to Firebase using the Firebase community builder image.
- Finally, step five, after the site has been deployed the
dist/pages.json
(only produced inproduction
builds) is read byalgolia.js
and then updates the data in Algolia.
To manually deploy the site you'll need to be a member of one of these Google teams:
- web.dev-eng
- web.dev-owners
- Navigate to the Cloud Build Triggers page.
- Click the RUN button for the trigger named Deploy.
- 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 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.