From 144ea0701c5a711a609f695858627c109fecf579 Mon Sep 17 00:00:00 2001 From: hanueleee Date: Mon, 8 Jan 2024 21:44:41 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20slack=20=EC=95=8C=EB=A6=BC=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cicd-be.yml | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/cicd-be.yml b/.github/workflows/cicd-be.yml index 6c4d9ea4..055b7176 100644 --- a/.github/workflows/cicd-be.yml +++ b/.github/workflows/cicd-be.yml @@ -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 @@ -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 }}