Skip to content

Commit cb0c484

Browse files
committed
fix: 스택을 삭제하고 재배포하도록 수정
1 parent 2769103 commit cb0c484

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/deploy-lambda-dev.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,23 @@ jobs:
7373
fi
7474
echo "Lambda ZIP 파일 생성 확인 ($(du -h build/distributions/main-1.1.2-lambda.zip | cut -f1))"
7575
76+
# Step 3.5: Clean up failed stack if exists
77+
- name: Clean up failed stack
78+
run: |
79+
STACK_STATUS=$(aws cloudformation describe-stacks --stack-name sopt-crew-dev --query 'Stacks[0].StackStatus' --output text --region ap-northeast-2 2>/dev/null || echo "NONE")
80+
81+
if [ "$STACK_STATUS" = "ROLLBACK_COMPLETE" ]; then
82+
echo "⚠️ 스택이 ROLLBACK_COMPLETE 상태입니다. 삭제 중..."
83+
aws cloudformation delete-stack --stack-name sopt-crew-dev --region ap-northeast-2
84+
echo "스택 삭제 대기 중..."
85+
aws cloudformation wait stack-delete-complete --stack-name sopt-crew-dev --region ap-northeast-2
86+
echo "✅ 스택 삭제 완료"
87+
elif [ "$STACK_STATUS" = "NONE" ]; then
88+
echo "새로운 스택을 생성합니다."
89+
else
90+
echo "현재 스택 상태: $STACK_STATUS"
91+
fi
92+
7693
# Step 4: Deploy with SAM
7794
- name: Deploy to AWS Lambda
7895
id: deploy

0 commit comments

Comments
 (0)