diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-04-02 11:25:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-02 11:25:12 -0400 |
commit | c0ee027d346191238c01d9fd35f45cc695bd1ae6 (patch) | |
tree | 69efc68445cfcdfaf823ef1b777e2cd4b842d181 /tools/release/01_bump_crate_versions.ts | |
parent | 94885bc2932fa0e40feee877f7f68fc5e68f76c8 (diff) |
chore(ci): automatically include releases notes in release draft (#14179)
Diffstat (limited to 'tools/release/01_bump_crate_versions.ts')
-rwxr-xr-x | tools/release/01_bump_crate_versions.ts | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/tools/release/01_bump_crate_versions.ts b/tools/release/01_bump_crate_versions.ts index c87be4591..a032475fb 100755 --- a/tools/release/01_bump_crate_versions.ts +++ b/tools/release/01_bump_crate_versions.ts @@ -9,6 +9,7 @@ const cliCrate = workspace.getCliCrate(); const originalCliVersion = cliCrate.version; // update the std version used in the code +console.log("Updating std version..."); await updateStdVersion(); // increment the cli version @@ -32,6 +33,7 @@ await workspace.getCliCrate().cargoUpdate("--workspace"); // try to update the Releases.md markdown text try { + console.log("Updating Releases.md..."); await updateReleasesMd(); } catch (err) { console.error(err); @@ -43,38 +45,14 @@ try { } async function updateReleasesMd() { - const filePath = path.join(DenoWorkspace.rootDirPath, "Releases.md"); - const oldFileText = await Deno.readTextFile(filePath); - const insertText = await getReleasesMdText(); - - await Deno.writeTextFile( - filePath, - oldFileText.replace(/^### /m, insertText + "\n\n### "), - ); - - await workspace.runFormatter(); - console.log( - "Updated Release.md -- Please review the output to ensure it's correct.", - ); -} - -async function getReleasesMdText() { const gitLog = await getGitLog(); - const formattedGitLog = gitLog.formatForReleaseMarkdown(); - const formattedDate = getFormattedDate(new Date()); - - return `### ${cliCrate.version} / ${formattedDate}\n\n` + - `${formattedGitLog}`; - - function getFormattedDate(date: Date) { - const formattedMonth = padTwoDigit(date.getMonth() + 1); - const formattedDay = padTwoDigit(date.getDate()); - return `${date.getFullYear()}.${formattedMonth}.${formattedDay}`; + const releasesMdFile = workspace.getReleasesMdFile(); + releasesMdFile.updateWithGitLog({ + version: cliCrate.version, + gitLog, + }); - function padTwoDigit(val: number) { - return val.toString().padStart(2, "0"); - } - } + await workspace.runFormatter(); } async function getGitLog() { |