-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (29 loc) · 1004 Bytes
/
main.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
# .github/workflows/deploy.yml
name: Deploy to Cloud Run
on:
push:
branches:
- main
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
APP_ID: labate
RUN_REGION: asia-southeast1
SA_KEY_JSON: ${{ secrets.GCP_SA_KEY_JSON }}
jobs:
deploy:
name: Deploy to Cloud Run
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, 'to deploy')"
steps:
- uses: actions/checkout@v2
# Setup gcloud CLI
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
version: "290.0.1"
service_account_key: ${{ secrets.GCP_SA_KEY_JSON }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
# Build and push image to Google Container Registry
- name: Build
run: gcloud builds submit --tag gcr.io/$PROJECT_ID/$APP_ID:$GITHUB_SHA
- name: Deploy
run: gcloud run deploy $APP_ID --image gcr.io/$PROJECT_ID/$APP_ID:$GITHUB_SHA --platform managed --region $RUN_REGION --allow-unauthenticated