This Github action can be used to deploy code to Cloud Functions.
name: "Deploy code to Cloud Function"
on:
pull_request: {}
push:
branches: ["main"]
jobs:
deploy_schemas:
runs-on: ubuntu-latest
name: Deploy code to Cloud Function
steps:
# To use this repository's private action,
# you must check out the repository
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Deploy code to Cloud Function
uses: jashparekh/cloud-functions-action@v1
env:
gcp_project: "gcp-us-project"
gcp_region: "us-central1"
cloud_function_name: "function-1"
cloud_function_directory: "directory/function-code"
credentials: ${{ secrets.GCP_SERVICE_ACCOUNT }}
The name of the GCP project you want to deploy.
Example: gcp-us-project
GCP region where the cloud function is hosted.
Example: us-central1
Name of the cloud function in GCP.
Example: function-1
The directory in your repository where are you storing the code files for cloud function.
Example: directory/function-code
Google Service Account with permission to create objects in the specified project. Can be stored as a repository secret
See the Contributing Guide for additional information.
To execute tests locally (requires that docker
and docker-compose
are installed):
docker-compose run test
This Github Action was originally written by Jash Parekh.