chore: automatically update Releases.md when doing a release (#13837)

Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
This commit is contained in:
David Sherret 2022-03-04 22:28:23 -05:00 committed by Yoshiya Hinosawa
parent b36176e645
commit 55a706e0ca
No known key found for this signature in database
GPG Key ID: 0E8BFAA8A5B4E92B
4 changed files with 32 additions and 8 deletions

View File

@ -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.

View File

@ -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(

View File

@ -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",
]);
}
}

View File

@ -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";