How To Deploy Google Cloud Functions from CircleCI

Create A Service Account and Keys

Login to your console and select “Service Accounts” from the IAM & admin menu.
Click the “CREATE SERVICE ACCOUNT” button to create a service account.
Click the create button to create the service account — you’ll be taken to the next screen in the wizard.
Assign the “Cloud Functions Developer” and “Service Account User” roles, so the service account can perform deployment actions.

Enable The Cloud Functions API

Create the CircleCI Project and Add Environment Variables

An example .circleci/config.yaml file for deploying the src directory to Google Cloud Functions.

Setting Up The CircleCI Project

Set Environment Variables

cat the_service_account_file.json | base64
Don’t share this key with anyone — even the base64 encoded version. (This key can be shared because it has already been destroyed).

Deployment

A completed deployment from the CircleCI console.
The deployed cloud function.

Questions?

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store