Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 21 additions & 25 deletions scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,16 @@ const releaseOptions: SemanticRelease.Options = (() => {
};
})();

const generateGhaSummary = (nextRelease: SemanticRelease.NextRelease) => {
const repoUrl = (releaseOptions.repositoryUrl as string)
.replace(/^git\+/, '')
.replace(/.git$/, '');
const generateSummary = (result: SemanticRelease.Result) => {
let content = '## 🚀 Release Report';

const content = `## 🚀 Release Report
if (result) {
const { nextRelease } = result;
const repoUrl = (releaseOptions.repositoryUrl as string)
.replace(/^git\+/, '')
.replace(/.git$/, '');

content += `
- Type: ${nextRelease.type}
- Version: ${nextRelease.version}
- Tag: ${nextRelease.gitTag}
Expand All @@ -186,6 +190,14 @@ See this release at this [link](${repoUrl}/releases/tag/${nextRelease.gitTag}).

## 📝 Generated Notes
${nextRelease.notes}`;
} else {
content += `
- Type: N/A
- Version: N/A
- Tag: N/A

No release published.`;
}

return content;
};
Expand All @@ -197,32 +209,16 @@ const runRelease = async () => {

console.info('--------------------------------------------------\n');

if (!result) {
console.info('No release published.');
const summary = generateSummary(result);

if (isGHA) {
await Bun.$`printf "%s" "🧪 No Release Published" >> $GITHUB_STEP_SUMMARY`;
}

return;
}

const { nextRelease } = result;
console.info(summary);

if (isGHA) {
const summary = generateGhaSummary(nextRelease);

console.info('Generating github step summary...');
await Bun.$`printf "%s" "${summary}" >> $GITHUB_STEP_SUMMARY`;
console.info('> $GITHUB_STEP_SUMMARY');
console.info();
console.info('--------------------------------------------------\n');
}

console.info(`${chalk.bold('Release Report')}\n`);
console.info(`Type: ${nextRelease.type}`);
console.info(`Version: ${nextRelease.version}`);
console.info(`Tag: ${nextRelease.gitTag}`);
console.info();
console.info('--------------------------------------------------\n');
} catch (err) {
if (err instanceof Error) {
console.error(`${err.name}:`, `${chalk.white(err.message)}`);
Expand Down
Loading