From 2fca4f11fe22a5d49326b6bf5b3ef039403eb0df Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 12 Jul 2024 18:44:55 -0400 Subject: [PATCH] chore: include current versions more in release checklist (#24562) --- tools/release/00_start_release.ts | 46 +++++++++++++++++---------- tools/release/release_doc_template.md | 37 ++++++++++----------- 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/tools/release/00_start_release.ts b/tools/release/00_start_release.ts index 4488c781af..b5c35ae5a5 100755 --- a/tools/release/00_start_release.ts +++ b/tools/release/00_start_release.ts @@ -5,27 +5,33 @@ import { $, createOctoKit, semver } from "./deps.ts"; const currentDirPath = $.path(import.meta).parentOrThrow(); $.logStep("Getting next version..."); +const currentVersion = semver.parse(getCliVersion())!; 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} release checklist`, - public: false, - files: { - [`release_${nextVersion}.md`]: { - content: buildDenoReleaseInstructionsDoc(), +const releaseInstructions = buildDenoReleaseInstructionsDoc(); +if (Deno.args.some((a) => a === "--dry-run")) { + console.log(releaseInstructions); +} else { + const octoKit = createOctoKit(); + const result = await octoKit.request("POST /gists", { + description: `Deno CLI v${nextVersion} release checklist`, + public: false, + files: { + [`release_${nextVersion}.md`]: { + content: releaseInstructions, + }, }, - }, -}); + }); -$.log("=============================================="); -$.log("Created gist with instructions!"); -$.log(""); -$.log(` ${result.data.html_url}`); -$.log(""); -$.log("Please fork the gist and follow the checklist."); -$.log("=============================================="); + $.log("=============================================="); + $.log("Created gist with instructions!"); + $.log(""); + $.log(` ${result.data.html_url}`); + $.log(""); + $.log("Please fork the gist and follow the checklist."); + $.log("=============================================="); +} function getNextVersion(originalVersion: semver.SemVer) { if (Deno.args.some((a) => a === "--patch")) { @@ -40,11 +46,17 @@ function getNextVersion(originalVersion: semver.SemVer) { } function buildDenoReleaseInstructionsDoc() { + function getMinorVersion(version: string) { + return version.split(".").slice(0, 2).join("."); + } + const templateText = currentDirPath .join("release_doc_template.md") .readTextSync() .replaceAll("$BRANCH_NAME", `v${nextVersion.major}.${nextVersion.minor}`) - .replaceAll("$VERSION", nextVersion.toString()); + .replaceAll("$VERSION", nextVersion.toString()) + .replaceAll("$MINOR_VERSION", getMinorVersion(nextVersion.toString())) + .replaceAll("$PAST_VERSION", currentVersion.toString()); return `# Deno CLI ${nextVersion.toString()} Release Checklist\n\n${templateText}`; } diff --git a/tools/release/release_doc_template.md b/tools/release/release_doc_template.md index 4c9b2c056a..5cc7245ce7 100644 --- a/tools/release/release_doc_template.md +++ b/tools/release/release_doc_template.md @@ -31,28 +31,28 @@ Release checklist: ## Patch release preparation **If you are cutting a patch release**: First you need to sync commits to the -relevant minor branch in the `deno` repo, so if you are cutting a `v1.43.3` -release you need to sync `v1.43` branch. +`v$MINOR_VERSION` branch in the `deno` repo. -To do that, you need to cherry-pick commits from the main branch to the `v1.43` -branch. If the branch doesn't exist yet, create one from the latest minor tag: +To do that, you need to cherry-pick commits from the main branch to the +`v$MINOR_VERSION` branch. If the branch doesn't exist yet, create one from the +latest minor tag: ``` # checkout latest minor release -$ git checkout v1.43.0 +$ git checkout v$PAST_VERSION # create a branch -$ git checkout v1.43 +$ git checkout v$MINOR_VERSION # push the branch to the `denoland/deno` repository -$ git push upstream v1.43 +$ git push upstream v$MINOR_VERSION ``` For patch releases we want to cherry-pick all commits that do not add features to the CLI. This generally means to filter out `feat` commits. -Check what was the last commit on `v1.43` branch before the previous release and -start cherry-picking newer commits from the `main`. +Check what was the last commit on `v$MINOR_VERSION` branch before the previous +release and start cherry-picking newer commits from the `main`.