Skip to content

Commit

Permalink
chore: 배포 알림 메시지, 전송 시점 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
kikingki committed Nov 19, 2024
1 parent fddcb65 commit 6a765f9
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

# 배포 시작 알림 전송
- name: Start Deployment
continue-on-error: true
run: |
curl -X POST -H "Content-Type: application/json" --data '{"content":"🚀 Deployment has started."}' ${{ secrets.DISCORD_WEBHOOK }}
# Docker Hub 로그인
- name: Login to Docker Hub
uses: docker/login-action@v1
Expand Down Expand Up @@ -66,12 +72,6 @@ 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 @@ -85,18 +85,18 @@ jobs:
docker-compose pull
docker-compose up -d
# 배포 후 보안 그룹에서 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
# 배포 완료 알림 전송
- name: Notify Deployment Completed
if: success()
run: |
curl -X POST -H "Content-Type: application/json" --data '{"content":"Deployment completed successfully!"}' ${{ secrets.DISCORD_WEBHOOK }}
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
curl -X POST -H "Content-Type: application/json" --data '{"content":"❌ Deployment failed...😢 Check the logs and try again!"}' ${{ secrets.DISCORD_WEBHOOK }}

0 comments on commit 6a765f9

Please sign in to comment.