Skip to content

Commit

Permalink
feat(ci): Use job-notification action for release notification
Browse files Browse the repository at this point in the history
  • Loading branch information
helenff committed Apr 13, 2023
1 parent f46eb4a commit cc8e269
Showing 1 changed file with 3 additions and 70 deletions.
73 changes: 3 additions & 70 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,6 @@ env:
AWS_REGION: us-east-2
DOCKER_BUILDKIT: 1
DOCKER_CACHE_PATH: ${{ github.workspace }}/tmp/docker-cache
NOTIFICATION_FIELDS: >
[
{
title: 'Repository',
value: `${process.env.AS_REPO}`,
short: true
},
{
title: 'Environment',
value: `${process.env.GITHUB_REF_SLUG}`,
short: true
},
{
title: 'Author',
value: `${process.env.AS_AUTHOR}`,
short: true
},
{
title: 'Commit',
value: `${process.env.AS_COMMIT}`,
short: true
},
{
title: 'Job',
value: `${process.env.AS_JOB}`,
short: true
},
{
title: 'Duration',
value: `${process.env.AS_TOOK}`,
short: true
},
{
title: 'Commit Message',
value: `${process.env.AS_MESSAGE}`,
short: false
}
]

jobs:
release:
Expand Down Expand Up @@ -97,38 +59,9 @@ jobs:
if: always()
run: docker logout ${{ steps.login-ecr.outputs.registry }}

- name: Set status emoji
id: release-status
if: always()
run: |
if [ "${{ job.status }}" = "success" ]; then
echo "::set-output name=emoji::large_green_square"
echo "::set-output name=color::good"
elif [ "${{ job.status }}" = "failure" ]; then
echo "::set-output name=emoji::large_red_square"
echo "::set-output name=color::danger"
else
echo "::set-output name=emoji::large_orange_square"
echo "::set-output name=color::warning"
fi
- name: Send Slack notification
if: always()
uses: 8398a7/action-slack@v3.9.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
uses: scribd/job-notification@v1.0.0
with:
author_name: "GitHub on ${{ github.repository }}"
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
status: custom
job_name: 'Release'
custom_payload: |
{
text: `:${{ steps.release-status.outputs.emoji }}: *Workflow ${ process.env.AS_WORKFLOW } ${{ job.status }}*`,
attachments: [
{
color: '${{ steps.release-status.outputs.color }}',
fields: ${{ env.NOTIFICATION_FIELDS }}
}
]
}
token: ${{ secrets.SCRIBD_SLACK_GENERIC_TOKEN_PUBLIC }}
channel: service-foundations-release

0 comments on commit cc8e269

Please sign in to comment.