diff --git a/.github/workflows/packy-cd-dev.yml b/.github/workflows/packy-cd-dev.yml index f180257..4784096 100644 --- a/.github/workflows/packy-cd-dev.yml +++ b/.github/workflows/packy-cd-dev.yml @@ -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 }} diff --git a/.github/workflows/packy-cd-prod.yml b/.github/workflows/packy-cd-prod.yml index 502c3c3..e7307a5 100644 --- a/.github/workflows/packy-cd-prod.yml +++ b/.github/workflows/packy-cd-prod.yml @@ -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: diff --git a/.github/workflows/reusable-cd.yml b/.github/workflows/reusable-cd.yml index b63b760..1932cfc 100644 --- a/.github/workflows/reusable-cd.yml +++ b/.github/workflows/reusable-cd.yml @@ -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 @@ -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 }}