Skip to content

Merge pull request #18 from OperationSpark/update-deps #22

Merge pull request #18 from OperationSpark/update-deps

Merge pull request #18 from OperationSpark/update-deps #22

Workflow file for this run

name: GCP Cloud Functions Deploy
on:
push:
branches:
- "main"
jobs:
build-deploy-cloud-function:
permissions:
contents: "read"
id-token: "write"
environment: production
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: "auth"
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GCP_SA_CREDS_JSON }}"
# Workaround to support Gen2 Cloud Functions
# https://github.com/google-github-actions/deploy-cloud-functions/issues/304
- name: "Set up Cloud SDK"
uses: "google-github-actions/setup-gcloud@v2"
- id: "deploy"
run: >
gcloud
functions
deploy
shorty
--gen2
--region=us-central1
--source=.
--runtime=go122
--trigger-http
--allow-unauthenticated
--entry-point=ServeShorty
--max-instances=5
--project=operationspark-org
--set-build-env-vars=GOFLAGS=-mod=mod
--set-env-vars=MONGO_URI="${{secrets.MONGO_URI}}",MONGO_DB_NAME="${{secrets.MONGO_DB_NAME}}",API_KEY="${{secrets.API_KEY}}",HOST_BASE_URL="${{secrets.HOST_BASE_URL}}",GCP_PROJECT_ID="${{secrets.GCP_PROJECT_ID}}"
- id: "trigger-url"
run: 'echo "${{ steps.deploy.outputs.url }}"'