From af618e3b8fb11f3947ab5ded9523cdca9cf77ced Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 8 Aug 2022 19:31:45 -0400 Subject: chore: make the start_release workflow go faster (#15416) --- tools/release/00_start_release.ts | 33 +++++++++++++++++++++++---------- tools/release/release_doc_template.md | 23 +++++++++++++---------- 2 files changed, 36 insertions(+), 20 deletions(-) mode change 100644 => 100755 tools/release/00_start_release.ts (limited to 'tools/release') diff --git a/tools/release/00_start_release.ts b/tools/release/00_start_release.ts old mode 100644 new mode 100755 index 6c0c555a0..b98fc147f --- a/tools/release/00_start_release.ts +++ b/tools/release/00_start_release.ts @@ -1,20 +1,19 @@ -#!/usr/bin/env -S deno run -A --lock=tools/deno.lock.json +#!/usr/bin/env -S deno run -A --quiet --lock=tools/deno.lock.json // Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. -import { DenoWorkspace } from "./deno_workspace.ts"; import { $, createOctoKit, semver } from "./deps.ts"; -$.logStep("Loading cli crate..."); -const workspace = await DenoWorkspace.load(); -const cliCrate = workspace.getCliCrate(); -const nextVersion = getNextVersion(semver.parse(cliCrate.version)!); +const currentDirPath = $.path.dirname($.path.fromFileUrl(import.meta.url)); + +$.logStep("Getting next version..."); +const nextVersion = getNextVersion(semver.parse(getCliVersion())!); $.logStep("Creating gist with instructions..."); const octoKit = createOctoKit(); const result = await octoKit.request("POST /gists", { - description: `Deno CLI v${nextVersion.toString()} release checklist`, + description: `Deno CLI v${nextVersion} release checklist`, public: false, files: { - "release_instructions.md": { + [`release_${nextVersion}.md`]: { content: buildDenoReleaseInstructionsDoc(), }, }, @@ -23,7 +22,7 @@ const result = await octoKit.request("POST /gists", { $.log("=============================================="); $.log("Created gist with instructions!"); $.log(""); -$.log(` ${result.url}`); +$.log(` ${result.data.html_url}`); $.log(""); $.log("Please fork the gist and follow the checklist."); $.log("=============================================="); @@ -41,9 +40,23 @@ function getNextVersion(originalVersion: semver.SemVer) { } function buildDenoReleaseInstructionsDoc() { - const currentDirPath = $.path.dirname($.path.fromFileUrl(import.meta.url)); const templateText = Deno.readTextFileSync( $.path.join(currentDirPath, "release_doc_template.md"), ); return `# Deno CLI ${nextVersion.toString()} Release Checklist\n\n${templateText}`; } + +function getCliVersion() { + const cargoTomlText = Deno.readTextFileSync( + $.path.join(currentDirPath, "../../cli/Cargo.toml"), + ); + const result = cargoTomlText.match(/^version\s*=\s*"([^"]+)"$/m); + if (result == null || result.length !== 2) { + $.log("Cargo.toml"); + $.log("=========="); + $.log(cargoTomlText); + $.log("=========="); + throw new Error("Could not find version in text."); + } + return result[1]; +} diff --git a/tools/release/release_doc_template.md b/tools/release/release_doc_template.md index 9c8ee9ae1..ce874e975 100644 --- a/tools/release/release_doc_template.md +++ b/tools/release/release_doc_template.md @@ -1,4 +1,6 @@ -## Pre-flight checklist +- [ ] Fork this gist and follow the instructions there. + +## Pre-flight - Forks and local clones of [`denoland/deno`](https://github.com/denoland/deno/), @@ -13,7 +15,7 @@ release from) should be frozen and no commits should land until the release is cut.** - [ ] Write a message in company's #cli channel: - `:lock: deno and deno_std are now locked ()` + `:lock: deno and deno_std are now locked ()` ## Patch release preparation @@ -51,7 +53,7 @@ verify on GitHub that everything looks correct. - ⛔ DO NOT create a release tag manually. That will automatically happen.
- ❌ Failure Steps + Failure Steps 1. Checkout the latest main. 2. Manually run `./_tools/release/01_bump_version.ts --minor` @@ -67,7 +69,7 @@ verify on GitHub that everything looks correct. - [ ] Review the draft release and then publish it.
- ❌ Failure Steps + Failure Steps 1. Tag the repo manually in the format `x.x.x` 2. Draft a new GH release by copying and pasting the release notes from @@ -90,10 +92,10 @@ verify on GitHub that everything looks correct. - [ ] Wait for the workflow to complete and for a pull request to be automatically opened. Review the pull request, make any necessary changes, and merge it. - - ⛔ DO NOT create a release tag manually. + - ⛔ DO NOT create a release tag manually That will automatically happen.
- ❌ Failure Steps + Failure Steps 1. Checkout the branch the release is being made on. 2. Manually run `./tools/release/01_bump_crate_versions.ts` @@ -110,7 +112,7 @@ verify on GitHub that everything looks correct. 1. Run it on the same branch that you used before and wait for it to complete.
- ❌ Failure Steps + Failure Steps 1. The workflow was designed to be restartable. Try restarting it. 2. If that doesn't work, then do the following: @@ -140,7 +142,8 @@ verify on GitHub that everything looks correct. - ⛔ Verify that: - [ ] There are 8 assets on the release draft. - - [ ] There are 4 zip files for this version on dl.deno.land + - [ ] There are 4 zip files for this version on + [dl.deno.land](https://console.cloud.google.com/storage/browser/dl.deno.land/release). - [ ] The aarch64 Mac build was built from the correct branch AFTER the version bump and has the same version as the release when doing `deno -V` (ask someone with an M1 Mac to verify this if you don't have @@ -154,7 +157,7 @@ verify on GitHub that everything looks correct. - [ ] This should open a PR. Review and merge it.
- ❌ Failure Steps + Failure Steps 1. Update https://github.com/denoland/dotland/blob/main/versions.json manually. @@ -183,7 +186,7 @@ queries the GitHub API to determine what it needs to change and update. - This will open a PR. Review it and merge, which will trigger a deployment.
- ❌ Failure Steps + Failure Steps 1. Checkout a new branch for docland (e.g. `git checkout -b deno_1.17.0`). 2. Execute `deno task build` -- cgit v1.2.3