Skip to content
A template repository to make it super easy to deploy Node.js code to Google Cloud Functions.
Shell JavaScript Dockerfile
Branch: production
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This is a template repository designed to make it super easy to deploy Node.js code to Google Cloud Functions. As well, it comes with a GitHub Actions workflow, designed to be triggered remotely.

Using this template

After cloning this repo, all you really need to do is replace the words sampleFunction and sample-function with the name of your function, and define your function code in sampleFunction.js. The repo is totally ready to be deployed using the gcloud utility, provided you have configured the necessary environment variables.

More information can be found in the script folder.

Secrets / Environment variables

All of the following are required as Secrets stored in your repository, or as environment variables if you're deploying locally.

For more information about using Secrets in GitHub Actions, please see the Actions docs.


Provided you've set those secrets correctly up above, you can deploy your function at any time by issuing a call to GitHub's Deployments API, like this:

curl -u $USER:$PASSWORD \
  -H "Accept: application/vnd.github.ant-man-preview+json" \
  -X POST \$owner/$repo/deployments \
  -d '{"ref": "production"}'

The final function will be hosted at: https://$REGION-$$FUNCTION_NAME

Deploying to a staging environment

In addition to the default production environment, the workflow/deploy script also supports sending a function to a staging environment:

curl -u $USER:$PASSWORD \
  -H "Accept: application/vnd.github.ant-man-preview+json" \
  -X POST \$owner/$repo/deployments \
  -d '{"ref": "production", "environment": "staging"}'

It does this by rewriting the function name on deployment to be prepended with staging__.

You can’t perform that action at this time.