Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy: CD 워크플로우 성공 시 슬랙 알림 전송 #283

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
Loading