|
63 | 63 | cache: 'pnpm' |
64 | 64 | cache-dependency-path: 'pnpm-lock.yaml' |
65 | 65 |
|
| 66 | + - name: Get current repo name |
| 67 | + id: info |
| 68 | + run: echo "::set-output name=repository_name::$(echo ${{ github.repository }} | sed -e 's/${{ github.repository_owner }}\///')" |
| 69 | + |
66 | 70 | - name: Install project dependencies |
67 | 71 | run: pnpm install --frozen-lockfile |
68 | 72 |
|
|
73 | 77 | - run: aws s3 cp --recursive ./dist s3://${{ secrets[matrix.aws_s3_bucket_key] }}/ |
74 | 78 |
|
75 | 79 | - run: aws cloudfront create-invalidation --distribution-id ${{ secrets[matrix.aws_cloudfront_distribution_key] }} --paths "/*" |
| 80 | + |
| 81 | + # Notify to Slack (Success) |
| 82 | + - name: Notify deployment to Slack |
| 83 | + if: failure() || cancelled() |
| 84 | + |
| 85 | + with: |
| 86 | + channel-id: ${{ vars.SLACK_DEPLOYMENT_ALERT_CHANNEL }} |
| 87 | + payload: | |
| 88 | + { |
| 89 | + "blocks": [ |
| 90 | + { |
| 91 | + "type": "header", |
| 92 | + "text": { |
| 93 | + "type": "plain_text", |
| 94 | + "text": "${{ steps.info.outputs.repository_name }} 버전 배포 실패 :rotating_light: (${{ job.status }})", |
| 95 | + "emoji": true |
| 96 | + } |
| 97 | + }, |
| 98 | + { |
| 99 | + "type": "section", |
| 100 | + "text": {"type": "mrkdwn", "text": "GitHub Action 바로가기"}, |
| 101 | + "accessory": { |
| 102 | + "type": "button", |
| 103 | + "text": {"type": "plain_text", "text": "${{ github.run_id }}"}, |
| 104 | + "value": "github_action", |
| 105 | + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", |
| 106 | + "action_id": "button-action" |
| 107 | + } |
| 108 | + } |
| 109 | + ] |
| 110 | + } |
| 111 | + env: |
| 112 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
| 113 | + |
| 114 | + # Notify to Slack (Failure) |
| 115 | + - name: Notify deployment to Slack |
| 116 | + |
| 117 | + with: |
| 118 | + channel-id: ${{ vars.SLACK_DEPLOYMENT_ALERT_CHANNEL }} |
| 119 | + payload: | |
| 120 | + { |
| 121 | + "blocks": [ |
| 122 | + { |
| 123 | + "type": "header", |
| 124 | + "text": { |
| 125 | + "type": "plain_text", |
| 126 | + "text": "${{ steps.info.outputs.repository_name }} 버전 배포 성공 :tada:", |
| 127 | + "emoji": true |
| 128 | + } |
| 129 | + }, |
| 130 | + { |
| 131 | + "type": "section", |
| 132 | + "text": {"type": "mrkdwn", "text": "GitHub Action 바로가기"}, |
| 133 | + "accessory": { |
| 134 | + "type": "button", |
| 135 | + "text": {"type": "plain_text", "text": "${{ github.run_id }}"}, |
| 136 | + "value": "github_action", |
| 137 | + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", |
| 138 | + "action_id": "button-action" |
| 139 | + } |
| 140 | + } |
| 141 | + ] |
| 142 | + } |
| 143 | + env: |
| 144 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
0 commit comments