Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Github Action to build a docker image, Upload it to Google cloud image registry and deploy a new Cloud Run revision

License

Notifications You must be signed in to change notification settings

ride-app/build-push-deploy-cloud-run

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

build-push-deploy-cloud-run

Build a docker image, Upload it to Google cloud image registry and deploy a new Cloud Run revision

Table of contents

Prerequisites

This action requires:

  1. A Google Cloud service account with the following roles:

    • Cloud Run Admin
    • Storage Admin
    • Service Account User

    alt text

  2. Enable the Cloud Run API

Usage

An Example workflow of Compiling, Building, Pushing and Releasing a Typescipt Project

    steps:
    - name: Checkout Code
      uses: actions/checkout@v2

    - name: Setup Node
      uses: actions/setup-node@v2
      with:
        node-version: '16'

    - name: Compile Typescript
      run: npx tsc

    - name: Deploy to Cloud Run
      uses: ride-app/deploy-cloud-run@v1
      with:
        project-id: demo-project
        image-name: hello-world
        service-account: ${{ secrets.GCP_SA_KEY }}

Inputs

Name Requirement Default Description
project-id Required ID of the Google Cloud project
image-name Required Name of the container image to deploy (Example: gcr.io/project-id/image-name:latest).
service-account Required Service account key to use for authentication. This should be the JSON formatted private key which can be exported from the Cloud Console. The value can be raw or base64-encoded.
region optional us-central1 Region in which the resource can be found.
dockerfile-path optional Path of the dockerfile to use to build the container.
build-args optional Build Arguments to pass to docker during build. This is only required if your dockerfile uses ARG to take build arguments.
env_vars optional List of key-value pairs to set as environment variables in the format: KEY1=VALUE1,KEY2=VALUE2. All existing environment variables will be retained.
secrets optional List of key-value pairs to set as either environment variables or mounted volumes in the format: KEY1=secret-key-1:latest,/secrets/api/key=secret-key-2:latest. The secrets will be fetched from the Secret Manager. All existing environment secrets or volumes will be retained.
tag optional Traffic tag to assign to the newly created revision.

Outputs

  • url: The URL of the deployed Cloud Run service revision.

About

Github Action to build a docker image, Upload it to Google cloud image registry and deploy a new Cloud Run revision

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published