From f92da1796e40e8df099644350769327550e16f7b Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Fri, 3 Mar 2023 06:08:05 -0800 Subject: [PATCH] Update release guide and fix release script (#7276) Signed-off-by: Sebastian Malton --- RELEASE_GUIDE.md | 9 ++++++--- packages/release-tool/src/index.ts | 14 +++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/RELEASE_GUIDE.md b/RELEASE_GUIDE.md index 01969bbbee43..338d7154e9ad 100644 --- a/RELEASE_GUIDE.md +++ b/RELEASE_GUIDE.md @@ -11,9 +11,12 @@ All releases will be made by creating a PR which bumps the version field in the ## Steps -1. If you are making a minor or major release (or prereleases for one) make sure you are on the `master` branch. +1. If you are making a minor or major release (or prereleases of one) make sure you are on the `master` branch. 1. If you are making a patch release (or a prerelease for one) make sure you are on the `release/v.` branch. -1. Run `npm run create-release-pr `. If you are making a subsequent prerelease release, provide the `--check-commits` flag. -1. If you are checking the commits, type `y` to pick a commit, and `n` to skip it. You will want to skip the commits that were part of previous prerelease releases. +1. Run `npm run create-release-pr`. +1. Pick the PRs that you want to include in this release using the keys listed. 1. Once the PR is created, approved, and then merged the `Release Open Lens` workflow will create a tag and release for you. 1. If you are making a major or minor release, create a `release/v.` branch and push it to `origin` so that future patch releases can be made from it. +1. If you released a major or minor version, create a new patch milestone and move all bug issues to that milestone and all enhancement issues to the next minor milestone. +1. If you released a patch version, create a new patch milestone for the next patch version and move all the issues and PRs (open or closed) that weren't included in the current release to that milestone. +1. Close the milestone related to the release that was just made (if not a prerelease release). diff --git a/packages/release-tool/src/index.ts b/packages/release-tool/src/index.ts index 8c1e465ffd4d..2632d883f061 100755 --- a/packages/release-tool/src/index.ts +++ b/packages/release-tool/src/index.ts @@ -145,6 +145,14 @@ function formatSemverForMilestone(version: SemVer): string { return `${version.major}.${version.minor}.${version.patch}`; } +function formatVersionForPickingPrs(version: SemVer): string { + if (version.prerelease.length > 0) { + return `${version.major}.${version.minor}.${version.patch}`; + } + + return `${version.major}.${version.minor}.${version.patch+1}`; +} + async function createReleaseBranchAndCommit(prBase: string, version: SemVer, prBody: string): Promise { const prBranch = `release/v${version.format()}`; @@ -182,9 +190,10 @@ function sortExtendedGithubPrData(left: ExtendedGithubPrData, right: ExtendedGit return -1; } -async function getRelevantPRs(milestone: string, previousReleasedVersion: string): Promise { +async function getRelevantPRs(previousReleasedVersion: string): Promise { console.log("retrieving previous 200 PRs..."); + const milestone = formatVersionForPickingPrs(await getCurrentVersionOfSubPackage("core")); const getMergedPrsArgs = [ "gh", "pr", @@ -326,8 +335,7 @@ async function createRelease(): Promise { await bumpPackageVersions(); } - const prMilestone = formatSemverForMilestone(await getCurrentVersionOfSubPackage("core")); - const relevantPrs = await getRelevantPRs(prMilestone, previousReleasedVersion); + const relevantPrs = await getRelevantPRs(previousReleasedVersion); const selectedPrs = await pickRelevantPrs(relevantPrs, isMasterBranch); const prBody = formatChangelog(previousReleasedVersion, selectedPrs);