Skip to content

Commit be8daac

Browse files
committed
Fix: 배포 상태 체크 수정
1 parent 05fe594 commit be8daac

File tree

1 file changed

+28
-20
lines changed

1 file changed

+28
-20
lines changed

.github/workflows/deploy.yml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,31 +46,39 @@ jobs:
4646
run: echo "start_time=$(date -u +%s)" >> $GITHUB_OUTPUT
4747

4848
- name: Render 배포 요청
49-
run: curl "${{ secrets.RENDER_DEPLOY_HOOK_URL }}"
49+
id: render-deploy
50+
run: |
51+
RESPONSE=$(curl -s "${{ secrets.RENDER_DEPLOY_HOOK_URL }}")
52+
DEPLOY_ID=$(echo "$RESPONSE" | jq -r '.deploy.id')
53+
echo "deploy_id=$DEPLOY_ID" >> $GITHUB_OUTPUT
5054
51-
- name: Render 배포 상태 확인
55+
- name: Render 배포 상태 확인 (Deploy ID로 확인)
5256
run: |
53-
echo "🔍 Render 배포 상태 확인 중..."
54-
API_URL="https://api.render.com/v1/services/${{ secrets.RENDER_SVC_ID }}"
5557
TOKEN="${{ secrets.RENDER_TOKEN }}"
56-
START_TIME=${{ steps.start-time.outputs.start_time }}
58+
DEPLOY_ID="${{ steps.render-deploy.outputs.deploy_id }}"
59+
API_URL="https://api.render.com/v1/services/${{ secrets.RENDER_SVC_ID }}/deploys"
5760
5861
for i in {1..60}; do
59-
RESPONSE=$(curl -s -H "Authorization: Bearer $TOKEN" "$API_URL")
60-
UPDATED_AT=$(echo "$RESPONSE" | jq -r '.updatedAt')
62+
RESPONSE=$(curl -s -H "Authorization: Bearer $TOKEN" "$API_URL")
63+
64+
STATUS=$(echo "$RESPONSE" | jq -r --arg DEPLOY_ID "$DEPLOY_ID" '
65+
.[]
66+
| select(.deploy.id == $DEPLOY_ID)
67+
| .deploy.status
68+
')
69+
70+
echo "현재 상태: $STATUS"
6171
62-
if [ "$UPDATED_AT" = "null" ]; then
63-
echo "API 응답 오류, 다시 시도 중..."
64-
else
65-
UPDATED_TIME=$(date -u -d "$UPDATED_AT" +%s)
72+
if [ "$STATUS" == "live" ]; then
73+
echo "배포 완료"
74+
exit 0
75+
elif [[ "$STATUS" == "build_failed" || "$STATUS" == "update_failed" || "$STATUS" == "canceled" ]]; then
76+
echo "배포 실패 (status: $STATUS)"
77+
exit 1
78+
fi
6679
67-
if [ "$UPDATED_TIME" -gt "$START_TIME" ]; then
68-
echo "Render 배포 완료 (updatedAt: $UPDATED_AT)"
69-
exit 0
70-
fi
71-
fi
72-
sleep 5
73-
done
80+
sleep 5
81+
done
7482

75-
echo "배포 확인 불가"
76-
exit 1
83+
echo "시간 초과: 배포 상태 확인 실패"
84+
exit 1

0 commit comments

Comments
 (0)