Skip to content

Workflow file for this run

name: Deploy to Cloud Run
on:
push:
branches:
- main
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
SERVICE_NAME: ${{ secrets.SERVICE_NAME }}
IMAGE: ${{ secrets.GCP_IMAGE }}
REGION: ${{ secrets.GCP_REGION }}
TAG: latest
jobs:
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy.
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- id: "auth"
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ secrets.GCLOUD_AUTH }}"
- name: Setup Google Cloud
uses: google-github-actions/setup-gcloud@v1
with:
service_account_key: ${{ secrets.GCLOUD_AUTH }}
project_id: ${{ secrets.PROJECT_ID }}
- name: Configure Docker
run: gcloud auth configure-docker asia-northeast1-docker.pkg.dev
- name: Build
run: docker build --platform linux/amd64 -f Dockerfile -t asia-northeast1-docker.pkg.dev/$PROJECT_ID/$SERVICE_NAME/$IMAGE:$TAG .
- name: Push
run: docker push asia-northeast1-docker.pkg.dev/$PROJECT_ID/$SERVICE_NAME/$IMAGE:$TAG
- id: 'Deploy'
uses: 'google-github-actions/deploy-cloudrun@v2'
with:
service: 'faq-server'
region: 'asia-northeast1'
image: 'asia-northeast1-docker.pkg.dev/$PROJECT_ID/$SERVICE_NAME/$IMAGE:$TAG'