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
45 changes: 20 additions & 25 deletions tools/continuous-delivery/src/publishReleaseNotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,26 @@ import { Changelog } from './utils/changelog';

export const publishReleaseNotes = async (version: string, lastVersionChangelogs: ChangelogItem[]) => {
log('Publishing release note.');
try {
log('Authorizing in github...');
await fs.writeFile('./.gh-auth-token.txt', String(process.env.GITHUB_SECRET));
execSync('gh auth login --with-token < ./.gh-auth-token.txt', {

log('Authorizing in github...');
execSync(`echo ${String(process.env.GITHUB_SECRET)} | gh auth login --with-token`, {
encoding: 'utf-8',
stdio: ['inherit', 'inherit', 'inherit'],
});
log('Authorized in github.');
log(`Publishing release note for "${version}"...`);
const releaseNotes = toMarkdown(Changelog.serializeRelease(lastVersionChangelogs))
.split('\n')
.slice(2)
.join('\n');
await fs.writeFile('./.github-release-notes.txt', releaseNotes);
execSync(
`gh release create "${version}" --title "${version}" --notes-file .github-release-notes.txt`,
{
encoding: 'utf-8',
stdio: ['inherit', 'inherit', 'inherit'],
});
await fs.rm('./.gh-auth-token.txt');
log('Authorized in github.');
log('Publishing release note...');
const releaseNotes = toMarkdown(Changelog.serializeRelease(lastVersionChangelogs))
.split('\n')
.slice(2)
.join('\n');
await fs.writeFile('./.github-release-notes.txt', releaseNotes);
execSync(
`gh release create "${version}" --title "${version}" --notes-file .github-release-notes.txt`,
{
encoding: 'utf-8',
stdio: ['inherit', 'inherit', 'inherit'],
},
);
await fs.rm('./.github-release-notes.txt');
log('Published release note.');
} catch (error) {
console.error(error);
}
},
);
await fs.rm('./.github-release-notes.txt');
log('Published release note.');
};
Loading