From 1c181733b2b37ccb43d1313ddd31fff1ae389eed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20B=C3=B6hm?= Date: Thu, 15 Aug 2024 15:41:15 +0200 Subject: [PATCH 1/4] Add improved deployment notification workflow --- .github/workflows/deployment-start.yml | 56 ++++++++++++++++++++++++++ .github/workflows/deployment.yml | 56 ++++++++++++++++++++++++++ .github/workflows/docker.yml | 7 ++-- .github/workflows/static-website.yml | 7 ++-- 4 files changed, 118 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/deployment-start.yml create mode 100644 .github/workflows/deployment.yml diff --git a/.github/workflows/deployment-start.yml b/.github/workflows/deployment-start.yml new file mode 100644 index 0000000..97cf25b --- /dev/null +++ b/.github/workflows/deployment-start.yml @@ -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 }} diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml new file mode 100644 index 0000000..fabb81a --- /dev/null +++ b/.github/workflows/deployment.yml @@ -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 }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 037f2b1..d003a34 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -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 }} diff --git a/.github/workflows/static-website.yml b/.github/workflows/static-website.yml index b324da5..f0163df 100644 --- a/.github/workflows/static-website.yml +++ b/.github/workflows/static-website.yml @@ -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 }} From b21f27c6b38944f3bf87b341ca4818bcfcfaca09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20B=C3=B6hm?= Date: Thu, 15 Aug 2024 16:36:26 +0200 Subject: [PATCH 2/4] Use default github.token --- .github/workflows/deployment-start.yml | 6 +----- .github/workflows/deployment.yml | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deployment-start.yml b/.github/workflows/deployment-start.yml index 97cf25b..87b86bd 100644 --- a/.github/workflows/deployment-start.yml +++ b/.github/workflows/deployment-start.yml @@ -15,10 +15,6 @@ on: 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" @@ -52,5 +48,5 @@ jobs: - id: github uses: chrnorm/deployment-action@v2 with: - token: ${{ secrets.github-token }} + token: ${{ github.token }} environment: ${{ inputs.github-environment }} diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index fabb81a..cff758f 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -25,10 +25,6 @@ on: description: "Slack thread timestamp" secrets: - github-token: - required: true - description: "GitHub token for deployments" - slack-token: required: true description: "Slack token for posting messages" @@ -51,6 +47,6 @@ jobs: - id: github uses: chrnorm/deployment-status@v2 with: - token: ${{ secrets.github-token }} + token: ${{ github.token }} deployment-id: ${{ inputs.github-deployment-id }} state: ${{ inputs.github-deployment-state }} From bd05d3cf2d1c45c77dd7eb4fa9b27e91590f3e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20B=C3=B6hm?= Date: Fri, 16 Aug 2024 09:23:07 +0200 Subject: [PATCH 3/4] Simplify deployment notification jobs --- .github/workflows/deployment-start.yml | 14 +++++--------- .github/workflows/deployment.yml | 5 +---- .github/workflows/static-website.yml | 2 +- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/deployment-start.yml b/.github/workflows/deployment-start.yml index 87b86bd..8c06587 100644 --- a/.github/workflows/deployment-start.yml +++ b/.github/workflows/deployment-start.yml @@ -22,17 +22,18 @@ on: outputs: github-deployment-id: description: "GitHub deployment ID" - value: ${{ jobs.github.outputs.id }} + value: ${{ jobs.deployment-start.outputs.github-deployment-id }} slack-thread-ts: description: "Slack thread timestamp" - value: ${{ jobs.slack.outputs.ts }} + value: ${{ jobs.deployment-start.outputs.slack-thread-ts }} jobs: - slack: + deployment-start: runs-on: ubuntu-latest outputs: - ts: ${{ steps.slack.outputs.ts }} + slack-thread-ts: ${{ steps.slack.outputs.ts }} + github-deployment-id: ${{ steps.github.outputs.deployment_id }} steps: - id: slack uses: hollow/action-slack-deploy-pipeline@CORE-280 @@ -40,11 +41,6 @@ jobs: 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: diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index cff758f..efac72a 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -30,7 +30,7 @@ on: description: "Slack token for posting messages" jobs: - slack: + deployment: runs-on: ubuntu-latest steps: - id: slack @@ -41,9 +41,6 @@ jobs: thread_ts: ${{ inputs.slack-thread-ts }} conclusion: true - github: - runs-on: ubuntu-latest - steps: - id: github uses: chrnorm/deployment-status@v2 with: diff --git a/.github/workflows/static-website.yml b/.github/workflows/static-website.yml index f0163df..6142faf 100644 --- a/.github/workflows/static-website.yml +++ b/.github/workflows/static-website.yml @@ -138,7 +138,7 @@ jobs: parent: false - uses: hollow/action-slack-deploy-pipeline@CORE-280 - if: ${{ always() && inputs.slack-channel }} + if: ${{ always() && inputs.slack-thread-ts }} with: token: ${{ secrets.slack-token }} channel: ${{ inputs.slack-channel }} From a43c19cfd68e67424171021430137f6bda1538f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20B=C3=B6hm?= Date: Fri, 16 Aug 2024 10:41:52 +0200 Subject: [PATCH 4/4] Use remerge fork --- .github/workflows/deployment-start.yml | 2 +- .github/workflows/deployment.yml | 4 ++-- .github/workflows/docker.yml | 4 ++-- .github/workflows/static-website.yml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deployment-start.yml b/.github/workflows/deployment-start.yml index 8c06587..1fc6963 100644 --- a/.github/workflows/deployment-start.yml +++ b/.github/workflows/deployment-start.yml @@ -36,7 +36,7 @@ jobs: github-deployment-id: ${{ steps.github.outputs.deployment_id }} steps: - id: slack - uses: hollow/action-slack-deploy-pipeline@CORE-280 + uses: remerge/action-slack-deploy-pipeline@f21c7c7 with: token: ${{ secrets.slack-token }} channel: ${{ inputs.slack-channel }} diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index efac72a..bc55e63 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -12,7 +12,7 @@ on: github-deployment-state: type: string description: "GitHub deployment state" - default: "success" + default: success slack-channel: type: string @@ -34,7 +34,7 @@ jobs: runs-on: ubuntu-latest steps: - id: slack - uses: hollow/action-slack-deploy-pipeline@CORE-280 + uses: remerge/action-slack-deploy-pipeline@f21c7c7 with: token: ${{ secrets.slack-token }} channel: ${{ inputs.slack-channel }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d003a34..ad1c345 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -187,8 +187,8 @@ jobs: cache-to: type=gha,mode=max push: true - - uses: hollow/action-slack-deploy-pipeline@CORE-280 - 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 }} diff --git a/.github/workflows/static-website.yml b/.github/workflows/static-website.yml index 6142faf..3058b5a 100644 --- a/.github/workflows/static-website.yml +++ b/.github/workflows/static-website.yml @@ -137,7 +137,7 @@ jobs: destination: ${{ inputs.bucket }} parent: false - - uses: hollow/action-slack-deploy-pipeline@CORE-280 + - uses: remerge/action-slack-deploy-pipeline@f21c7c7 if: ${{ always() && inputs.slack-thread-ts }} with: token: ${{ secrets.slack-token }}