Skip to content

Commit

Permalink
Add improved deployment notification workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hollow committed Aug 15, 2024
1 parent fea76c7 commit 1c18173
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 8 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/deployment-start.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
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:
github-token:
required: true
description: "GitHub token for deployments"

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

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

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

jobs:
slack:
runs-on: ubuntu-latest
outputs:
ts: ${{ steps.slack.outputs.ts }}
steps:
- id: slack
uses: hollow/action-slack-deploy-pipeline@CORE-280
with:
token: ${{ secrets.slack-token }}
channel: ${{ inputs.slack-channel }}

github:
runs-on: ubuntu-latest
outputs:
id: ${{ steps.github.outputs.deployment_id }}
steps:
- id: github
uses: chrnorm/deployment-action@v2
with:
token: ${{ secrets.github-token }}
environment: ${{ inputs.github-environment }}
56 changes: 56 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
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:
github-token:
required: true
description: "GitHub token for deployments"

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

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

github:
runs-on: ubuntu-latest
steps:
- id: github
uses: chrnorm/deployment-status@v2
with:
token: ${{ secrets.github-token }}
deployment-id: ${{ inputs.github-deployment-id }}
state: ${{ inputs.github-deployment-state }}
7 changes: 3 additions & 4 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
- uses: hollow/action-slack-deploy-pipeline@CORE-280
if: ${{ always() && inputs.slack-channel }}
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 }}
7 changes: 3 additions & 4 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
- uses: hollow/action-slack-deploy-pipeline@CORE-280
if: ${{ always() && inputs.slack-channel }}
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 1c18173

Please sign in to comment.