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

Add improved deployment notification workflow #104

Merged
merged 4 commits into from
Aug 16, 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
48 changes: 48 additions & 0 deletions .github/workflows/deployment-start.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: deployment-start

on:
workflow_call:
inputs:
github-environment:
type: string
required: true
description: "GitHub environment to deploy to"

slack-channel:
type: string
required: true
description: "Slack channel to post to"

secrets:
slack-token:
required: true
description: "Slack token for posting messages"

outputs:
github-deployment-id:
description: "GitHub deployment ID"
value: ${{ jobs.deployment-start.outputs.github-deployment-id }}

slack-thread-ts:
description: "Slack thread timestamp"
value: ${{ jobs.deployment-start.outputs.slack-thread-ts }}

jobs:
deployment-start:
runs-on: ubuntu-latest
outputs:
slack-thread-ts: ${{ steps.slack.outputs.ts }}
github-deployment-id: ${{ steps.github.outputs.deployment_id }}
steps:
- id: slack
uses: remerge/action-slack-deploy-pipeline@f21c7c7
with:
token: ${{ secrets.slack-token }}
channel: ${{ inputs.slack-channel }}

- id: github
uses: chrnorm/deployment-action@v2
with:
token: ${{ github.token }}
environment: ${{ inputs.github-environment }}
49 changes: 49 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
name: deployment-start

on:
workflow_call:
inputs:
github-deployment-id:
type: string
required: true
description: "GitHub environment to deploy to"

github-deployment-state:
type: string
description: "GitHub deployment state"
default: success

slack-channel:
type: string
required: true
description: "Slack channel to post to"

slack-thread-ts:
type: string
required: false
description: "Slack thread timestamp"

secrets:
slack-token:
required: true
description: "Slack token for posting messages"

jobs:
deployment:
runs-on: ubuntu-latest
steps:
- id: slack
uses: remerge/action-slack-deploy-pipeline@f21c7c7
with:
token: ${{ secrets.slack-token }}
channel: ${{ inputs.slack-channel }}
thread_ts: ${{ inputs.slack-thread-ts }}
conclusion: true

- id: github
uses: chrnorm/deployment-status@v2
with:
token: ${{ github.token }}
deployment-id: ${{ inputs.github-deployment-id }}
state: ${{ inputs.github-deployment-state }}
9 changes: 4 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,9 @@ jobs:
cache-to: type=gha,mode=max
push: true

- uses: Fieldguide/action-slack-deploy-pipeline@v1
if: ${{ always() && inputs.slack-channel }}
- uses: remerge/action-slack-deploy-pipeline@f21c7c7
if: ${{ always() && inputs.slack-thread-ts }}
with:
token: ${{ secrets.slack-token }}
channel: ${{ inputs.slack-channel }}
thread_ts: ${{ inputs.slack-thread-ts }}
env:
SLACK_DEPLOY_BOT_TOKEN: ${{ secrets.slack-token }}
SLACK_DEPLOY_CHANNEL: ${{ inputs.slack-channel }}
9 changes: 4 additions & 5 deletions .github/workflows/static-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@ jobs:
destination: ${{ inputs.bucket }}
parent: false

- uses: Fieldguide/action-slack-deploy-pipeline@v1
if: ${{ always() && inputs.slack-channel }}
- uses: remerge/action-slack-deploy-pipeline@f21c7c7
if: ${{ always() && inputs.slack-thread-ts }}
with:
token: ${{ secrets.slack-token }}
channel: ${{ inputs.slack-channel }}
thread_ts: ${{ inputs.slack-thread-ts }}
env:
SLACK_DEPLOY_BOT_TOKEN: ${{ secrets.slack-token }}
SLACK_DEPLOY_CHANNEL: ${{ inputs.slack-channel }}