-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (42 loc) · 1.42 KB
/
deploy.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
47
48
49
50
51
52
53
name: Deploy
on:
push:
branches:
- main
jobs:
CD:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm install
- name: Generate Prisma Client
run: npx prisma generate
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCR_SA_KEY }}
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: Configure Docker for GCR Authentication
run: gcloud auth configure-docker gcr.io
- name: Build and Push Docker Image
run: |
IMAGE_NAME=gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.CLOUD_RUN_SERVICE_NAME_ADMIN }}
docker build -t $IMAGE_NAME .
docker push $IMAGE_NAME
- name: Deploy to Cloud Run
run: |
gcloud run deploy ${{ secrets.CLOUD_RUN_SERVICE_NAME_ADMIN }} \
--image gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.CLOUD_RUN_SERVICE_NAME_ADMIN }} \
--platform managed \
--region asia-southeast1 \
--allow-unauthenticated \
--set-env-vars API_URL=${{ secrets.API_URL }}