Skip to content

Cloud run personas action [NOT FOR MERGING] #5

Cloud run personas action [NOT FOR MERGING]

Cloud run personas action [NOT FOR MERGING] #5

Workflow file for this run

name: Deploy Personas to Cloud RUN
on:
push:
branches: [ "main", "development", "persona-action" ]
paths:
- 'personas-open-source/**'
workflow_dispatch:
inputs:
branch:
description: 'Branch to deploy from'
required: true
default: 'main'
pull_request:
branches:
- main
env:
SERVICE: persona
REGION: us-central1
jobs:
deploy:
environment: ${{ (github.ref == 'refs/heads/development' && 'development') || (github.ref == 'refs/heads/main' && 'prod') || (github.ref == 'refs/heads/persona-action' && 'development') }}
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Google Auth
id: auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- run: gcloud auth configure-docker
- name: Build and Push Docker image
run: |
docker build -t gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }} -f personas-open-source/Dockerfile .
docker push gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v0
with:
service: ${{ env.SERVICE }}
region: ${{ env.REGION }}
image: gcr.io/${{ vars.GCP_PROJECT_ID }}/${{ env.SERVICE }}
# If required, use the Cloud Run url output in later steps
- name: Show Output
run: echo ${{ steps.deploy.outputs.url }}