diff --git a/tools/continuous-delivery/src/publishReleaseNotes.ts b/tools/continuous-delivery/src/publishReleaseNotes.ts index 40ac453eae..f767780596 100644 --- a/tools/continuous-delivery/src/publishReleaseNotes.ts +++ b/tools/continuous-delivery/src/publishReleaseNotes.ts @@ -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.'); };