豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 5a1ba84

Browse files
committed
refactor(ng-dev/release): indicate that a major stable release is first cut as @next
When we previously cut v14, it was not quite obvious to the caretaker that the cut-stable action will publish to `@next` first (as it was requested/required by the release checklist).
1 parent 04a54cd commit 5a1ba84

File tree

2 files changed

+43
-11
lines changed

2 files changed

+43
-11
lines changed

ng-dev/release/publish/actions/cut-stable.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@ import {ExternalCommands} from '../external-commands.js';
1919
*/
2020
export class CutStableAction extends ReleaseAction {
2121
private _newVersion = this._computeNewVersion();
22+
private _isNewMajor = this.active.releaseCandidate!.isMajor;
2223

2324
override async getDescription() {
24-
const newVersion = this._newVersion;
25-
return `Cut a stable release for the release-candidate branch (v${newVersion}).`;
25+
if (this._isNewMajor) {
26+
return `Cut a stable release for the release-candidate branch — published as \`@next\` (v${this._newVersion}).`;
27+
} else {
28+
return `Cut a stable release for the release-candidate branch — published as \`@latest\` (v${this._newVersion}).`;
29+
}
2630
}
2731

2832
override async perform() {
2933
const {branchName} = this.active.releaseCandidate!;
3034
const newVersion = this._newVersion;
31-
const isNewMajor = this.active.releaseCandidate?.isMajor;
3235

3336
// When cutting a new stable minor/major, we want to build the release notes capturing
3437
// all changes that have landed in the individual next and RC pre-releases.
@@ -58,12 +61,12 @@ export class CutStableAction extends ReleaseAction {
5861
releaseNotes,
5962
beforeStagingSha,
6063
branchName,
61-
isNewMajor ? 'next' : 'latest',
64+
this._isNewMajor ? 'next' : 'latest',
6265
);
6366

6467
// If a new major version is published and becomes the "latest" release-train, we need
6568
// to set the LTS npm dist tag for the previous latest release-train (the current patch).
66-
if (isNewMajor) {
69+
if (this._isNewMajor) {
6770
const previousPatch = this.active.latest;
6871
const ltsTagForPatch = getLtsNpmDistTagOfMajor(previousPatch.version.major);
6972

ng-dev/release/publish/test/common.spec.ts

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ describe('common release action logic', () => {
4646
});
4747

4848
describe('version computation', () => {
49-
const testReleaseTrain = new ActiveReleaseTrains({
50-
releaseCandidate: new ReleaseTrain('10.1.x', parse('10.1.0-next.3')),
51-
next: new ReleaseTrain('master', parse('10.2.0-next.0')),
52-
latest: new ReleaseTrain('10.0.x', parse('10.0.1')),
53-
});
54-
5549
it('should not modify release train versions and cause invalid other actions', async () => {
50+
const testReleaseTrain = new ActiveReleaseTrains({
51+
releaseCandidate: new ReleaseTrain('10.1.x', parse('10.1.0-next.3')),
52+
next: new ReleaseTrain('master', parse('10.2.0-next.0')),
53+
latest: new ReleaseTrain('10.0.x', parse('10.0.1')),
54+
});
55+
5656
const {releaseConfig, githubConfig} = getTestConfigurationsForAction();
5757
const gitClient = getMockGitClient(githubConfig, /* useSandboxGitClient */ false);
5858
const descriptions: string[] = [];
@@ -74,6 +74,35 @@ describe('common release action logic', () => {
7474
`Cut a new release for an active LTS branch (0 active).`,
7575
]);
7676
});
77+
78+
it('should properly show descriptions when a major is in RC-phase', async () => {
79+
const testReleaseTrain = new ActiveReleaseTrains({
80+
releaseCandidate: new ReleaseTrain('15.0.x', parse('15.0.0-rc.1')),
81+
next: new ReleaseTrain('main', parse('15.1.0-next.0')),
82+
latest: new ReleaseTrain('14.3.x', parse('14.3.1')),
83+
});
84+
85+
const {releaseConfig, githubConfig} = getTestConfigurationsForAction();
86+
const gitClient = getMockGitClient(githubConfig, /* useSandboxGitClient */ false);
87+
const descriptions: string[] = [];
88+
89+
// Fake the NPM package request as otherwise the test would rely on `npmjs.org`.
90+
fakeNpmPackageQueryRequest(releaseConfig.representativeNpmPackage, {'dist-tags': {}});
91+
92+
for (const actionCtor of actions) {
93+
if (await actionCtor.isActive(testReleaseTrain, releaseConfig)) {
94+
const action = new actionCtor(testReleaseTrain, gitClient, releaseConfig, testTmpDir);
95+
descriptions.push(await action.getDescription());
96+
}
97+
}
98+
99+
expect(descriptions).toEqual([
100+
'Cut a stable release for the release-candidate branch — published as `@next` (v15.0.0).',
101+
'Cut a new patch release for the "14.3.x" branch (v14.3.2).',
102+
`Cut a new next pre-release for the "15.0.x" branch (v15.0.0-rc.2).`,
103+
`Cut a new release for an active LTS branch (0 active).`,
104+
]);
105+
});
77106
});
78107

79108
describe('publishing', () => {

0 commit comments

Comments
 (0)