@@ -188,21 +188,32 @@ jobs:
188
188
189
189
- name : Setup GCloud
190
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 }}
191
+ if : ${{ contains(github.ref, 'main') && github.event.pull_request.title != 'Feedback' }}
192
192
with :
193
193
service_account_key : ${{ secrets.GKE_SA_KEY }}
194
194
project_id : ${{ secrets.GKE_PROJECT }}
195
195
196
196
- name : Get GKE creds
197
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 }}
198
+ if : ${{ contains(github.ref, 'main') && github.event.pull_request.title != 'Feedback' }}
199
199
with :
200
200
cluster_name : ${{ secrets.GKE_CLUSTER }}
201
201
location : ${{ secrets.GKE_ZONE }}
202
202
credentials : ${{ secrets.GKE_SA_KEY }}
203
+
204
+ - name : Detect GKE Cluster
205
+ if : ${{ contains(github.ref, 'main') && github.event.pull_request.title != 'Feedback' }}
206
+ id : detect-gke
207
+ run : |-
208
+ is_up="$(gcloud container clusters list | grep cs3219-g16)"
209
+ if [[ -z "$is_up" ]]; then
210
+ echo "output=false" >> $GITHUB_OUTPUT
211
+ else
212
+ echo "output=true" >> $GITHUB_OUTPUT
213
+ fi
203
214
204
215
- name : Deploy to GKE
205
- if : ${{ contains(github.ref, 'main') && github.event.pull_request.title != 'Feedback' && env.IS_GKE_CLUSTER_UP }}
216
+ if : ${{ contains(github.ref, 'main') && github.event.pull_request.title != 'Feedback' && steps.detect-gke.output == 'true' }}
206
217
run : |-
207
218
service="${{ matrix.package }}"
208
219
deployment="frontend"
0 commit comments