Skip to content

Latest commit

 

History

History
59 lines (35 loc) · 2.39 KB

File metadata and controls

59 lines (35 loc) · 2.39 KB

Cloud Run Workflow

An example workflow that uses the setup-gcloud action to deploy to Cloud Run.

Checkout the deploy-cloudrun action and example workflows for a specialized implementation.

This code is intended to be an example. You will likely need to change or update values to match your setup.

Workflow description

For pushes to the example branch, this workflow will:

  1. Download and configure the Google Cloud SDK with the provided credentials.

  2. Authenticates Docker to push to Google Container Registry

  3. Build, tag, and push a container image to Google Container Registry.

    • The image is built using Docker and pushed to Google Container Registry.

    • The image is available through the following tags: latest and first 8 of the commit SHA.

  4. Deploy the image to Cloud Run.

Setup

  1. Create a new Google Cloud Project (or select an existing project).

  2. Enable the Cloud Run API.

  3. [Create a Google Cloud service account][sa] or select an existing one.

  4. Add the the following Cloud IAM roles to your service account:

    • Cloud Run Admin - allows for the creation of new Cloud Run services

    • Service Account User - required to deploy to Cloud Run as service account

    • Storage Admin - allow push to Google Container Registry

  5. Download a JSON service account key for the service account.

  6. Add the following [secrets to your repository's secrets][gh-secret]:

    • GCP_PROJECT: Google Cloud project ID

    • GCP_SA_KEY: the downloaded service account key