-
Notifications
You must be signed in to change notification settings - Fork 1
143 lines (135 loc) · 4.87 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Deploy to GCP
on:
push:
branches:
- main
jobs:
check-changes:
runs-on: ubuntu-latest
outputs:
fe: ${{ steps.filter.outputs.fe }}
api: ${{ steps.filter.outputs.api }}
question: ${{ steps.filter.outputs.question }}
user: ${{ steps.filter.outputs.user }}
matching: ${{ steps.filter.outputs.matching }}
session: ${{ steps.filter.outputs.session }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
fe:
- 'peerprep-fe/**'
- 'k8s/peerprep*'
- 'cloudbuilds/fe'
api:
- 'api-gateway/**'
- 'k8s/api-gateway*'
- 'cloudbuilds/'
question:
- 'question-service/**'
- 'k8s/question-service*'
- 'cloudbuilds/question-service.yaml'
user:
- 'user-service/**'
- 'k8s/user-service*'
- 'cloudbuilds/user-service.yaml'
matching:
- 'matching-service/**'
- 'k8s/matching-service*'
- 'cloudbuilds/matching-service.yaml'
session:
- 'session-service/**'
- 'k8s/session-service*'
- 'cloudbuilds/session-service.yaml'
deploy-fe:
needs: check-changes
if: ${{ needs.check-changes.outputs.fe == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: "auth"
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GCP_SA_KEY }}"
- uses: "google-github-actions/setup-gcloud@v2"
- name: "Trigger FE Cloud Build"
env:
NEXT_PUBLIC_API_GATEWAY_URL: ${{ secrets.NEXT_PUBLIC_API_GATEWAY_URL }}
NEXT_PUBLIC_GITHUB_CLIENT_ID: ${{ secrets.NEXT_PUBLIC_GITHUB_CLIENT_ID }}
NEXT_PUBLIC_SOCK_SERVER_URL: ${{ secrets.NEXT_PUBLIC_SOCK_SERVER_URL }}
NEXT_PUBLIC_AUDIO_SERVER_URL: ${{ secrets.NEXT_PUBLIC_AUDIO_SERVER_URL }}
run: |
gcloud builds submit --config cloudbuilds/fe.yaml \
--substitutions _NEXT_PUBLIC_API_GATEWAY_URL="$NEXT_PUBLIC_API_GATEWAY_URL",_NEXT_PUBLIC_GITHUB_CLIENT_ID="$NEXT_PUBLIC_GITHUB_CLIENT_ID",_NEXT_PUBLIC_SOCK_SERVER_URL="$NEXT_PUBLIC_SOCK_SERVER_URL",_NEXT_PUBLIC_AUDIO_SERVER_URL="$NEXT_PUBLIC_AUDIO_SERVER_URL"
deploy-api-gateway:
needs: check-changes
if: ${{ needs.check-changes.outputs.api == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: "auth"
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GCP_SA_KEY }}"
- uses: "google-github-actions/setup-gcloud@v2"
- name: "Trigger API Gateway Cloud Build"
run: |
gcloud builds submit --config cloudbuilds/api-gateway.yaml
deploy-question-svc:
needs: check-changes
if: ${{ needs.check-changes.outputs.question == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: "auth"
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GCP_SA_KEY }}"
- uses: "google-github-actions/setup-gcloud@v2"
- name: "Trigger Question Service Cloud Build"
run: |
gcloud builds submit --config cloudbuilds/question-service.yaml
deploy-user-svc:
needs: check-changes
if: ${{ needs.check-changes.outputs.user == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: "auth"
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GCP_SA_KEY }}"
- uses: "google-github-actions/setup-gcloud@v2"
- name: "Trigger User Service Cloud Build"
run: |
gcloud builds submit --config cloudbuilds/user-service.yaml
deploy-matching-svc:
needs: check-changes
if: ${{ needs.check-changes.outputs.matching == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: "auth"
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GCP_SA_KEY }}"
- uses: "google-github-actions/setup-gcloud@v2"
- name: "Trigger Matching Service Cloud Build"
run: |
gcloud builds submit --config cloudbuilds/matching-service.yaml
deploy-session-svc:
needs: check-changes
if: ${{ needs.check-changes.outputs.session == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: "auth"
uses: "google-github-actions/auth@v2"
with:
credentials_json: "${{ secrets.GCP_SA_KEY }}"
- uses: "google-github-actions/setup-gcloud@v2"
- name: "Trigger Session Service Cloud Build"
run: |
gcloud builds submit --config cloudbuilds/session-service.yaml