Skip to content

Commit

Permalink
deploy: CD 워크플로우 성공 시 슬랙 알림 전송 (#283)
Browse files Browse the repository at this point in the history
* deploy: Github Actions codecov 관련 설정 제거 및 슬랙 알림 연동

* deploy: 슬랙 알림 전송을 별도의 Job으로 분리
  • Loading branch information
leeeeeyeon committed Sep 4, 2024
1 parent 9c97c2a commit ef056c4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/packy-cd-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ jobs:
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_WEBHOOK: ${{ ssecrets.SLACK_WEBHOOK }}
4 changes: 2 additions & 2 deletions .github/workflows/packy-cd-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_WEBHOOK: ${{ ssecrets.SLACK_WEBHOOK }}
# - name: Update Release
# uses: release-drafter/release-drafter@v5
# with:
Expand Down
29 changes: 26 additions & 3 deletions .github/workflows/reusable-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ on:
required: true
AWS_REGION:
required: true
CODECOV_TOKEN:
SLACK_CHANNEL:
required: true
SLACK_WEBHOOK:
required: true

jobs:
run:
CD:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -78,3 +79,25 @@ jobs:
region: ${{ secrets.AWS_REGION }}
deployment_package: deploy/deploy.zip
wait_for_environment_recovery: 200

- name: Set Slack profile based on branch
run: |
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
echo "SLACK_PROFILE=운영계" >> $GITHUB_ENV
elif [[ "${GITHUB_REF}" == "refs/heads/develop" ]]; then
echo "SLACK_PROFILE=개발계" >> $GITHUB_ENV
fi
SlackNotify:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Notify Message to Slack
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: $ {{ secrets.SLACK_CHANNEL }}
SLACK_COLOR: ${{ job.status }}
SLACK_USERNAME: API 서버를 업데이트 했어요
SLACK_ICON: https://i.pinimg.com/236x/86/ac/ae/86acaefa1fff543ad4b49ed39a2f38bc.jpg
SLACK_TITLE: ${{ env.SLACK_PROFILE }} 서버 변경 사항
SLACK_MESSAGE: ${{ github.workflow }}

0 comments on commit ef056c4

Please sign in to comment.