-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (121 loc) · 4.11 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
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/**'
api:
- 'api-gateway/**'
question:
- 'question-service/**'
user:
- 'user-service/**'
matching:
- 'matching-service/**'
session:
- 'session-service/**'
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 }}
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"
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