-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (39 loc) · 1.67 KB
/
cloudrun.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
on:
push:
branches:
- main
name: Build and Deploy a Container
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT }}
SERVICE: good-day-app
REGION: us-central1
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Cloud SDK
uses: google-github-actions/[email protected]
with:
project_id: ${{ env.PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true # Set to true to authenticate the Cloud Run action
- name: Authorize Docker push
run: gcloud auth configure-docker
- name: Build and Push Container
run: |-
docker build -t gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }} ./
docker push gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/[email protected]
with:
service: ${{ env.SERVICE }}
image: gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }}
region: ${{ env.REGION }}
env_vars: DATABASE_DSN=root@tcp(127.0.0.1:3306)/good-day
secrets: SLACK_BOT_TOKEN=slack-bot-token:latest,SLACK_SIGNING_SECRET=slack-signing-secret:latest,PLANETSCALE_ORG=planetscale-org:latest,PLANETSCALE_SERVICE_TOKEN_NAME=planetscale-service-token-name:latest,PLANETSCALE_SERVICE_TOKEN=planetscale-service-token:latest,BASE_URL=self-base-url:latest,URL_SIGNING_KEY_BASE64=url-signing-key-base64:latest,RENDER_URL=chart-renderer-url:latest
- name: Show Output
run: echo ${{ steps.deploy.outputs.url }}