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.
For pushes to the example
branch, this workflow will:
-
Download and configure the Google Cloud SDK with the provided credentials.
-
Authenticates Docker to push to Google Container Registry
-
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.
-
-
Deploy the image to Cloud Run.
-
Create a new Google Cloud Project (or select an existing project).
-
Create a Google Cloud service account or select an existing one.
-
Add 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
-
-
Download a JSON service account key for the service account.
-
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
-