Skip to content

Commit 75b0218

Browse files
committed
PEER-242: Update action script
Signed-off-by: SeeuSim <[email protected]>
1 parent e17ec07 commit 75b0218

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

.github/workflows/build-deploy-docker.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,21 +188,32 @@ jobs:
188188

189189
- name: Setup GCloud
190190
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' }}
192192
with:
193193
service_account_key: ${{ secrets.GKE_SA_KEY }}
194194
project_id: ${{ secrets.GKE_PROJECT }}
195195

196196
- name: Get GKE creds
197197
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' }}
199199
with:
200200
cluster_name: ${{ secrets.GKE_CLUSTER }}
201201
location: ${{ secrets.GKE_ZONE }}
202202
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
203214
204215
- 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' }}
206217
run: |-
207218
service="${{ matrix.package }}"
208219
deployment="frontend"

0 commit comments

Comments
 (0)