Skip to content

Commit

Permalink
feat: slack 알림 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hanueleee committed Jan 8, 2024
1 parent f444d87 commit 144ea07
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/cicd-be.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ jobs:
name: cicdsample
path: build/libs/*.jar

- name: Slack notification when build fail
if: failure()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: [CI/CD] 백엔드 빌드 실패
fields: repo, message, commit, author, action, eventName, ref, workflow, job, took
env:
SLACK_COLOR: '#FF2D00'
SLACK_USERNAME: 'Github Action'
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_CICD }}

deploy:
needs: build
runs-on: ubuntu-latest
Expand All @@ -71,3 +84,29 @@ jobs:
run: |
ssh ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }} "chmod +x ./deploy.sh"
ssh ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }} "./deploy.sh"
- name: Slack notification when deploy fail
if: failure()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: [CI/CD] 백엔드 배포 실패
fields: repo, message, commit, author, action, eventName, ref, workflow, job, took
env:
SLACK_COLOR: '#FF2D00'
SLACK_USERNAME: 'Github Action'
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_CICD }}

- name: Slack notification when deploy success
if: success()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: [CI/CD] 백엔드 배포 성공
fields: repo, message, commit, author, action, eventName, ref, workflow, job, took
env:
SLACK_COLOR: '#0019F4'
SLACK_USERNAME: 'Github Action'
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_CICD }}

0 comments on commit 144ea07

Please sign in to comment.