@@ -105,7 +105,7 @@ jobs:
105
105
echo "Outputs Generated: $formatted_matrix"
106
106
echo "matrix=$formatted_matrix" >> $GITHUB_OUTPUT
107
107
108
- build-and- push-image :
108
+ build-push-deploy -image :
109
109
needs : changes
110
110
if : ${{ fromJson(needs.changes.outputs.matrix)[0] != null }}
111
111
runs-on : ubuntu-latest
@@ -186,14 +186,38 @@ jobs:
186
186
cache-from : type=gha
187
187
cache-to : type=gha,mode=max
188
188
189
+ - name : Setup GCloud
190
+ uses : google-github-actions/setup-gcloud@v2
191
+ if : ${{ contains(github.ref, 'main') && github.event.pull_request.title != 'Feedback' && env.IS_GKE_CLUSTER_UP }}
192
+ with :
193
+ service_account_key : ${{ secrets.GKE_SA_KEY }}
194
+ project_id : ${{ secrets.GKE_PROJECT }}
195
+
196
+ - name : Get GKE creds
197
+ uses : google-github-actions/get-gke-credentials@v2
198
+ if : ${{ contains(github.ref, 'main') && github.event.pull_request.title != 'Feedback' && env.IS_GKE_CLUSTER_UP }}
199
+ with :
200
+ cluster_name : ${{ secrets.GKE_CLUSTER }}
201
+ location : ${{ secrets.GKE_ZONE }}
202
+ credentials : ${{ secrets.GKE_SA_KEY }}
203
+
204
+ - name : Deploy to GKE
205
+ if : ${{ contains(github.ref, 'main') && github.event.pull_request.title != 'Feedback' && env.IS_GKE_CLUSTER_UP }}
206
+ run : |-
207
+ deployments=("collab-service" "matching-service" "question-service" "user-service" "frontend")
208
+ for dplymnt in "${deployments[@]}"; do
209
+ kubectl -n peerprep rollout restart deployment "$dplymnt"
210
+ done
211
+
212
+
189
213
results :
190
214
if : ${{ always() && !github.event.pull_request.draft }}
191
215
runs-on : ubuntu-latest
192
216
name : Final Results
193
- needs : build-and- push-image
217
+ needs : build-push-deploy -image
194
218
steps :
195
219
- run : |
196
- result="${{ needs.build-and- push-image.result }}"
220
+ result="${{ needs.build-push-deploy -image.result }}"
197
221
if [[ $result == "success" || $result == "skipped" ]]; then
198
222
exit 0
199
223
else
0 commit comments