-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.48 KB
/
gccr-deployment.yaml
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
47
48
49
50
51
52
name: Google Cloud Cloud Run Deployment
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy to Google Cloud
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install Dependencies
run: npm ci
- name: Run Migrations to Cloud SQL
run: npm run migrate
env:
MYSQL_HOST: ${{ secrets.MYSQL_HOST }}
MYSQL_DATABASE: ${{ secrets.MYSQL_DATABASE }}
MYSQL_USERNAME: ${{ secrets.MYSQL_USERNAME }}
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }}
MYSQL_DIALECT: ${{ secrets.MYSQL_DIALECT }}
- name: Authenticate with Google Cloud
uses: google-github-actions/setup-gcloud@v0.5.0
with:
project_id: ${{ secrets.GCP_PROJECT }}
service_account_key: ${{ secrets.GCP_CREDENTIALS }}
- name: Build to Cloud Build and Push to Artifact Registry
run: |
gcloud config set project ${{ secrets.GCP_PROJECT }}
gcloud builds submit --config cloudbuild.yaml .
- name: Deploy to Cloud Run
id: deploy_cloud_run
uses: google-github-actions/deploy-cloudrun@v0.3.0
with:
service: backend
region: asia-southeast2
image: asia-southeast2-docker.pkg.dev/${{ secrets.GCP_PROJECT }}/vive-app/backend
credentials: ${{ secrets.GCP_CREDENTIALS }}