Skip to content

Commit

Permalink
ITDS-63 feat: CI/CD workflow 배포 시작 전후 discord 알림 전송 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kikingki committed Nov 19, 2024
1 parent fcf109c commit 9b58fc4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ jobs:
run: |
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32
# 배포 시작 알림 전송
- name: Start Deployment
continue-on-error: true
run: |
curl -X POST -H "Content-Type: application/json" --data '{"content":"Deployment started!"}' ${{ secrets.DISCORD_WEBHOOK }}
# ssh로 접속해 재배포
- name: Deploy
uses: appleboy/ssh-action@master
Expand All @@ -79,7 +85,18 @@ jobs:
docker-compose pull
docker-compose up -d
# 배포 완료 알림 전송
- name: Notify Deployment Completed
if: success()
run: |
curl -X POST -H "Content-Type: application/json" --data '{"content":"Deployment completed successfully!"}' ${{ secrets.DISCORD_WEBHOOK }}
- name: Notify Deployment Failed
if: failure()
run: |
curl -X POST -H "Content-Type: application/json" --data '{"content":"Deployment failed!"}' ${{ secrets.DISCORD_WEBHOOK }}
# 배포 후 보안 그룹에서 github ip 삭제
- name: Remove Github Actions IP From Security Group
if: always()
run: |
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32

0 comments on commit 9b58fc4

Please sign in to comment.