Skip to content

Commit

Permalink
[continuous-delivery] send notification when publish new release
Browse files Browse the repository at this point in the history
Signed-off-by: r.lysov <r.lysov@semrush.com>
  • Loading branch information
lsroman committed Jan 4, 2023
1 parent 26b2520 commit d2ed33e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
4 changes: 3 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tools/continuous-delivery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"private": true,
"license": "MIT",
"dependencies": {
"@semcore/changelog-handler": "0.0.1",
"@semcore/changelog-handler": "*",
"@semcore/slack-integration": "*",
"axios": "0.25.0",
"dayjs": "1.10.7",
"dotenv": "^16.0.3",
Expand Down
16 changes: 13 additions & 3 deletions tools/continuous-delivery/src/runPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
serializeReleaseChangelog,
toMarkdown,
} from '@semcore/changelog-handler';
import { sendMessage, makeMessageFromChangelogs } from '@semcore/slack-integration';

dotenv.config();
const git = Git();

Expand Down Expand Up @@ -84,9 +86,8 @@ export const runPublisher = async (versionPatches: VersionPatch[]) => {
await fs.rm('./.gh-auth-token.txt');
const semcoreUiChangelog = await getReleaseChangelog();
const version = semcoreUiChangelog.package.version;
const releaseNotes = toMarkdown(
serializeReleaseChangelog(semcoreUiChangelog.changelogs.slice(0, 1)),
)
const lastVersionChangelogs = semcoreUiChangelog.changelogs.slice(0, 1);
const releaseNotes = toMarkdown(serializeReleaseChangelog(lastVersionChangelogs))
.split('\n')
.slice(2)
.join('\n');
Expand All @@ -99,6 +100,15 @@ export const runPublisher = async (versionPatches: VersionPatch[]) => {
},
);
await fs.rm('./.github-release-notes.txt');

const title = `New release v${version} is here!`;
const body = makeMessageFromChangelogs(lastVersionChangelogs, false);

await sendMessage({
title,
body,
dryRun: false,
});
}
}
};

0 comments on commit d2ed33e

Please sign in to comment.