my-finance-pal-backend/.github/workflows/cd.yaml

31 lines
897 B
YAML

name: CD
on:
workflow_run:
workflows: [CI]
types: [completed]
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' }}
steps:
- name: Authenticate with Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: Setup gcloud CLI
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Deploy app to Cloud Run
run: |
gcloud run deploy my-finance-pal \
--image ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/cloud-run-builds/my-finance-pal:${{ github.sha }} \
--allow-unauthenticated \
--region ${{ secrets.GCP_REGION }}