diff --git a/tools/cut_a_release.md b/tools/cut_a_release.md index 250b06bbb9..ca6cb9ff3f 100644 --- a/tools/cut_a_release.md +++ b/tools/cut_a_release.md @@ -97,10 +97,10 @@ verify on GitHub that everything looks correct. 9. If you are doing a patch release, answer `y` to the _Increment patch?_ prompt. -10. Use the output of the above command to update `Releases.md`. **If you are - cutting a minor release**: make sure that there are no duplicate entries in - previous releases; most often commits with `fix` prefix would have been - included in patch releases. +10. The above command will update the `Releases.md` file. Review it and ensure + its output is correct. **If you are cutting a minor release**: make sure + that there are no duplicate entries in previous releases; most often commits + with `fix` prefix would have been included in patch releases. 11. Update link in `cli/compat/mod.rs` with the released version of `deno_std` and do a search through the tests to find std urls that need to be updated. diff --git a/tools/release/03_bump_cli_version.ts b/tools/release/03_bump_cli_version.ts index bd1f3d1c63..553133405e 100755 --- a/tools/release/03_bump_cli_version.ts +++ b/tools/release/03_bump_cli_version.ts @@ -1,6 +1,7 @@ #!/usr/bin/env -S deno run --allow-read --allow-write --allow-run=cargo,git // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. import { DenoWorkspace } from "./deno_workspace.ts"; +import { path } from "./deps.ts"; const workspace = await DenoWorkspace.load(); const repo = workspace.repo; @@ -13,11 +14,23 @@ await cliCrate.promptAndIncrement(); // update the lock file await cliCrate.cargoCheck(); -// output the Releases.md markdown text +// update the Releases.md markdown text +await updateReleasesMd(); +await workspace.runFormatter(); console.log( - "You may use the following as a template for updating Releases.md:\n", + "Updated Release.md -- Please review the output to ensure it's correct.", ); -console.log(await getReleasesMdText()); + +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### "), + ); +} async function getReleasesMdText() { const gitLog = await repo.getGitLogFromTags( diff --git a/tools/release/deno_workspace.ts b/tools/release/deno_workspace.ts index 725d647df4..19c8f99983 100644 --- a/tools/release/deno_workspace.ts +++ b/tools/release/deno_workspace.ts @@ -67,4 +67,15 @@ export class DenoWorkspace { getCrate(name: string) { return this.#repo.getCrate(name); } + + runFormatter() { + return this.#repo.runCommandWithOutput([ + "deno", + "run", + "--allow-write", + "--allow-read", + "--allow-run", + "./tools/format.js", + ]); + } } diff --git a/tools/release/deps.ts b/tools/release/deps.ts index df7a4fc605..4a1ec87258 100644 --- a/tools/release/deps.ts +++ b/tools/release/deps.ts @@ -1,3 +1,3 @@ // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -export * from "https://raw.githubusercontent.com/denoland/automation/0.2.0/mod.ts"; +export * from "https://raw.githubusercontent.com/denoland/automation/0.3.0/mod.ts";