Skip to content

Commit

Permalink
Update release guide and fix release script (#7276)
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Malton <[email protected]>
  • Loading branch information
Nokel81 authored Mar 3, 2023
1 parent 15f6149 commit f92da17
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
9 changes: 6 additions & 3 deletions RELEASE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<MAJOR>.<MINOR>` branch.
1. Run `npm run create-release-pr <release-type>`. If you are making a subsequent prerelease release, provide the `--check-commits` flag.
1. If you are checking the commits, type `y<ENTER>` to pick a commit, and `n<ENTER>` 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<MAJOR>.<MINOR>` 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).
14 changes: 11 additions & 3 deletions packages/release-tool/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
const prBranch = `release/v${version.format()}`;

Expand Down Expand Up @@ -182,9 +190,10 @@ function sortExtendedGithubPrData(left: ExtendedGithubPrData, right: ExtendedGit
return -1;
}

async function getRelevantPRs(milestone: string, previousReleasedVersion: string): Promise<ExtendedGithubPrData[]> {
async function getRelevantPRs(previousReleasedVersion: string): Promise<ExtendedGithubPrData[]> {
console.log("retrieving previous 200 PRs...");

const milestone = formatVersionForPickingPrs(await getCurrentVersionOfSubPackage("core"));
const getMergedPrsArgs = [
"gh",
"pr",
Expand Down Expand Up @@ -326,8 +335,7 @@ async function createRelease(): Promise<void> {
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);

Expand Down

0 comments on commit f92da17

Please sign in to comment.