Skip to content

Notify Deployment Status #417

Notify Deployment Status

Notify Deployment Status #417

Workflow file for this run

name: Notify Deployment Status
# based on: https://github.com/integrations/slack/issues/1563#issuecomment-1588009077
on:
workflow_run:
workflows:
["Deploy to Dev from branch", "Staged deploy to Test, Preprod, and Prod"]
types: [completed]
jobs:
on-failure:
name: All deployment failures
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'timed_out'
steps:
- uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ github.event.workflow_run.conclusion }}
notification_title: " ${{github.event.workflow_run.name}} - ${{github.event.workflow_run.conclusion}} on ${{github.event.workflow_run.head_branch}} - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View Failure>"
message_format: ":fire: *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} in <${{github.server_url}}/${{github.repository}}/${{github.event.workflow_run.head_branch}}|${{github.repository}}>"
footer: "Linked Repo <${{github.server_url}}/${{github.repository}}|${{github.repository}}> | <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View Failure>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_ALERT_WEBHOOK }}
on-dev-deploy-success:
name: Dev and Test Deploy Success
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' && (github.event.workflow_run.name == 'Deploy to Dev from branch')
steps:
# Deploy to existing slack alerts channel on success for dev
- uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ github.event.workflow_run.conclusion }}
notification_title: "${{github.event.workflow_run.actor.login}} Successfully Deployed ${{github.event.workflow_run.head_branch}} to Dev - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View>"
message_format: ":rocket: *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} in <${{github.server_url}}/${{github.repository}}/${{github.event.workflow_run.head_branch}}|${{github.repository}}>"
footer: "Linked Repo <${{github.server_url}}/${{github.repository}}|${{github.repository}}> | <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_DATA_CATALOGUE_DEVS }}
on-prod-deploy-success:
name: Prod Deploy Success
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.name == 'Staged deploy to Test, Preprod, and Prod'
steps:
# Notify Slack - ask-data-catalogue
- uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ github.event.workflow_run.conclusion }}
notification_title: "Deployment Successful"
message_format: ":rocket: <https://find-moj-data.service.justice.gov.uk/|New Production Deployment>"
footer: "Linked Repo <${{github.server_url}}/${{github.repository}}|${{github.repository}}> | <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ASK_DATA_CATALOGUE }}
# Notify MS TEAMS - prod deployment notifications
- uses: jdcargile/ms-teams-notification@v1.4
with:
github-token: ${{ github.token }} # this will use the runner's token.
ms-teams-webhook-uri: ${{ secrets.TEAMS_WEBHOOK_PROD_DEPLOYMENTS }}
notification-summary: "Deployment Successful"
notification-color: 17a2b8
timezone: Europe/London
verbose-logging: true