Skip to content

Commit

Permalink
Merge pull request #104 from remerge/CORE-280
Browse files Browse the repository at this point in the history
Add improved deployment notification workflow
  • Loading branch information
hollow authored Aug 16, 2024
2 parents fea76c7 + a43c19c commit 6708e96
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 10 deletions.
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 }}

0 comments on commit 6708e96

Please sign in to comment.