-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (42 loc) · 1.44 KB
/
ci-cd.yml
File metadata and controls
52 lines (42 loc) · 1.44 KB
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: Deploy to Cloud Run
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Create .env file
run: echo "${{ secrets.ENV_FILE }}" > .env
- name: Create FCM key file
run: echo "${{ secrets.FCM_SERVICE_ACCOUNT }}" > src/main/resources/firebase-adminsdk.json
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew clean build -x test
- name: Authenticate to GCP
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
# Docker 이미지 빌드 & GCR 푸시
- name: Build and Push Docker image
run: |
gcloud auth configure-docker
docker build -t gcr.io/${{ secrets.GCP_PROJECT_ID }}/my-app:${{ github.sha }} .
docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/my-app:${{ github.sha }}
# Cloud Run 배포 (Compute Engine이랑 다른 부분)
- name: Deploy to Cloud Run
run: |
gcloud run deploy my-app \
--image gcr.io/${{ secrets.GCP_PROJECT_ID }}/my-app:${{ github.sha }} \
--region asia-northeast3 \
--platform managed \
--allow-unauthenticated \
--port 8080