Skip to content

Commit 2dc2752

Browse files
author
Eugene Cheung
authored
chore: send notification to Slack on release [skip ci] (#71)
I don't have a particularly good way of testing this. Based on: - https://github.com/cdklabs/construct-hub-webapp/pull/501/files Using: - https://github.com/bruceadams/get-release - https://github.com/slackapi/slack-github-action The webhook secret has already been added to the repo. --- _By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_
1 parent 1e5f331 commit 2dc2752

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projenrc.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const { awscdk, DependencyType, javascript } = require("projen");
2+
const { workflows } = require("projen/lib/github");
23

34
const CDK_VERSION = "1.123.0";
45
const CONSTRUCTS_VERSION = "3.3.69";
@@ -111,4 +112,42 @@ project.eslint.addRules({
111112
project.addPackageIgnore("*.ts");
112113
project.addPackageIgnore("!*.d.ts");
113114

115+
project.release.addJobs({
116+
notify_slack: {
117+
name: "Send Slack notification",
118+
runsOn: "ubuntu-latest",
119+
permissions: {
120+
actions: workflows.JobPermission.READ,
121+
},
122+
needs: [
123+
"release",
124+
"release_github",
125+
"release_maven",
126+
"release_npm",
127+
"release_nuget",
128+
"release_pypi",
129+
],
130+
steps: [
131+
{
132+
name: "Get release",
133+
id: "get_release",
134+
uses: "bruceadams/[email protected]",
135+
env: {
136+
GITHUB_TOKEN: "${{ github.token }}",
137+
},
138+
},
139+
{
140+
name: "Send notification",
141+
uses: "slackapi/[email protected]",
142+
with: {
143+
payload: `{"html_url": "\${{ steps.get_release.outputs.html_url }}", "tag_name": "\${{ steps.get_release.outputs.tag_name }}"}`,
144+
},
145+
env: {
146+
SLACK_WEBHOOK_URL: "${{ secrets.SLACK_WEBHOOK_URL }}",
147+
},
148+
},
149+
],
150+
},
151+
});
152+
114153
project.synth();

0 commit comments

Comments
 (0)