release-please 14.7.2 → 14.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/build/src/changelog-notes/default.js +4 -1
- package/build/src/factories/plugin-factory.js +2 -0
- package/build/src/manifest.d.ts +4 -1
- package/build/src/plugins/group-priority.d.ts +29 -0
- package/build/src/plugins/group-priority.js +82 -0
- package/build/src/release-pull-request.d.ts +1 -0
- package/build/src/strategies/base.d.ts +1 -0
- package/build/src/strategies/base.js +7 -0
- package/build/src/strategies/java.js +1 -0
- package/package.json +1 -1
- package/schemas/config.json +18 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
|
|
6
6
|
|
|
7
|
+
## [14.8.0](https://github.com/googleapis/release-please/compare/v14.7.2...v14.8.0) (2022-09-28)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* Add `group-priority` plugin ([#1660](https://github.com/googleapis/release-please/issues/1660)) ([3ca750a](https://github.com/googleapis/release-please/commit/3ca750af3be8af06f9b6d0ed835524d53eab09c5))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* Escape html tags in release notes ([#1661](https://github.com/googleapis/release-please/issues/1661)) ([891fdcb](https://github.com/googleapis/release-please/commit/891fdcb0776abd8b3518bb60c44873f55fd616a3))
|
|
18
|
+
|
|
7
19
|
## [14.7.2](https://github.com/googleapis/release-please/compare/v14.7.1...v14.7.2) (2022-09-26)
|
|
8
20
|
|
|
9
21
|
|
|
@@ -49,7 +49,7 @@ class DefaultChangelogNotes {
|
|
|
49
49
|
const changelogCommits = commits.map(commit => {
|
|
50
50
|
return {
|
|
51
51
|
body: '',
|
|
52
|
-
subject: commit.bareMessage,
|
|
52
|
+
subject: htmlEscape(commit.bareMessage),
|
|
53
53
|
type: commit.type,
|
|
54
54
|
scope: commit.scope,
|
|
55
55
|
notes: commit.notes.filter(note => note.title === 'BREAKING CHANGE'),
|
|
@@ -71,4 +71,7 @@ class DefaultChangelogNotes {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
exports.DefaultChangelogNotes = DefaultChangelogNotes;
|
|
74
|
+
function htmlEscape(message) {
|
|
75
|
+
return message.replace('<', '<').replace('>', '>');
|
|
76
|
+
}
|
|
74
77
|
//# sourceMappingURL=default.js.map
|
|
@@ -20,12 +20,14 @@ const node_workspace_1 = require("../plugins/node-workspace");
|
|
|
20
20
|
const maven_workspace_1 = require("../plugins/maven-workspace");
|
|
21
21
|
const errors_1 = require("../errors");
|
|
22
22
|
const sentence_case_1 = require("../plugins/sentence-case");
|
|
23
|
+
const group_priority_1 = require("../plugins/group-priority");
|
|
23
24
|
const pluginFactories = {
|
|
24
25
|
'linked-versions': options => new linked_versions_1.LinkedVersions(options.github, options.targetBranch, options.repositoryConfig, options.type.groupName, options.type.components),
|
|
25
26
|
'cargo-workspace': options => new cargo_workspace_1.CargoWorkspace(options.github, options.targetBranch, options.repositoryConfig, options),
|
|
26
27
|
'node-workspace': options => new node_workspace_1.NodeWorkspace(options.github, options.targetBranch, options.repositoryConfig, options),
|
|
27
28
|
'maven-workspace': options => new maven_workspace_1.MavenWorkspace(options.github, options.targetBranch, options.repositoryConfig, options),
|
|
28
29
|
'sentence-case': options => new sentence_case_1.SentenceCase(options.github, options.targetBranch, options.repositoryConfig, options.type.specialWords),
|
|
30
|
+
'group-priority': options => new group_priority_1.GroupPriority(options.github, options.targetBranch, options.repositoryConfig, options.type.groups),
|
|
29
31
|
};
|
|
30
32
|
function buildPlugin(options) {
|
|
31
33
|
if (typeof options.type === 'object') {
|
package/build/src/manifest.d.ts
CHANGED
|
@@ -142,7 +142,10 @@ export interface SentenceCasePluginConfig extends ConfigurablePluginType {
|
|
|
142
142
|
export interface WorkspacePluginConfig extends ConfigurablePluginType {
|
|
143
143
|
merge?: boolean;
|
|
144
144
|
}
|
|
145
|
-
export
|
|
145
|
+
export interface GroupPriorityPluginConfig extends ConfigurablePluginType {
|
|
146
|
+
groups: string[];
|
|
147
|
+
}
|
|
148
|
+
export declare type PluginType = DirectPluginType | ConfigurablePluginType | GroupPriorityPluginConfig | LinkedVersionPluginConfig | SentenceCasePluginConfig | WorkspacePluginConfig;
|
|
146
149
|
/**
|
|
147
150
|
* This is the schema of the manifest config json
|
|
148
151
|
*/
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ManifestPlugin } from '../plugin';
|
|
2
|
+
import { GitHub } from '../github';
|
|
3
|
+
import { RepositoryConfig, CandidateReleasePullRequest } from '../manifest';
|
|
4
|
+
/**
|
|
5
|
+
* This plugin allows configuring a priority of release groups. For example, you could
|
|
6
|
+
* prioritize Java snapshot pull requests over other releases.
|
|
7
|
+
*/
|
|
8
|
+
export declare class GroupPriority extends ManifestPlugin {
|
|
9
|
+
readonly groups: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Instantiate a new GroupPriority plugin.
|
|
12
|
+
*
|
|
13
|
+
* @param {GitHub} github GitHub client
|
|
14
|
+
* @param {string} targetBranch Release branch
|
|
15
|
+
* @param {RepositoryConfig} repositoryConfig Parsed configuration for the entire
|
|
16
|
+
* repository. This allows plugins to know how components interact.
|
|
17
|
+
* @param {string[]} groups List of group names ordered with highest priority first
|
|
18
|
+
*/
|
|
19
|
+
constructor(github: GitHub, targetBranch: string, repositoryConfig: RepositoryConfig, groups: string[]);
|
|
20
|
+
/**
|
|
21
|
+
* Group candidate release PRs by grouping and check our list of preferred
|
|
22
|
+
* groups in order. If a preferred group is found, only return pull requests for
|
|
23
|
+
* that group.
|
|
24
|
+
* @param {CandidateReleasePullRequest[]} pullRequests Candidate pull requests
|
|
25
|
+
* @returns {CandidateReleasePullRequest[]} Possibly a subset of the candidate
|
|
26
|
+
* pull requests if a preferred group is found.
|
|
27
|
+
*/
|
|
28
|
+
run(pullRequests: CandidateReleasePullRequest[]): Promise<CandidateReleasePullRequest[]>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2022 Google LLC
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.GroupPriority = void 0;
|
|
17
|
+
const plugin_1 = require("../plugin");
|
|
18
|
+
/**
|
|
19
|
+
* This plugin allows configuring a priority of release groups. For example, you could
|
|
20
|
+
* prioritize Java snapshot pull requests over other releases.
|
|
21
|
+
*/
|
|
22
|
+
class GroupPriority extends plugin_1.ManifestPlugin {
|
|
23
|
+
/**
|
|
24
|
+
* Instantiate a new GroupPriority plugin.
|
|
25
|
+
*
|
|
26
|
+
* @param {GitHub} github GitHub client
|
|
27
|
+
* @param {string} targetBranch Release branch
|
|
28
|
+
* @param {RepositoryConfig} repositoryConfig Parsed configuration for the entire
|
|
29
|
+
* repository. This allows plugins to know how components interact.
|
|
30
|
+
* @param {string[]} groups List of group names ordered with highest priority first
|
|
31
|
+
*/
|
|
32
|
+
constructor(github, targetBranch, repositoryConfig, groups) {
|
|
33
|
+
super(github, targetBranch, repositoryConfig);
|
|
34
|
+
this.groups = groups;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Group candidate release PRs by grouping and check our list of preferred
|
|
38
|
+
* groups in order. If a preferred group is found, only return pull requests for
|
|
39
|
+
* that group.
|
|
40
|
+
* @param {CandidateReleasePullRequest[]} pullRequests Candidate pull requests
|
|
41
|
+
* @returns {CandidateReleasePullRequest[]} Possibly a subset of the candidate
|
|
42
|
+
* pull requests if a preferred group is found.
|
|
43
|
+
*/
|
|
44
|
+
async run(pullRequests) {
|
|
45
|
+
this.logger.debug(`Group priority plugin running with groups: ${this.groups}`);
|
|
46
|
+
const groupedCandidates = groupCandidatesByType(pullRequests);
|
|
47
|
+
for (const group of this.groups) {
|
|
48
|
+
this.logger.debug(`Considering group: ${group}`);
|
|
49
|
+
const groupCandidates = groupedCandidates.get(group);
|
|
50
|
+
if (groupCandidates) {
|
|
51
|
+
this.logger.debug(`Found preferred group: ${group} with ${groupCandidates.length} candidate pull requests`);
|
|
52
|
+
return groupCandidates;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// fallback to returning all candidates
|
|
56
|
+
this.logger.debug('No preferred group found, returning full set.');
|
|
57
|
+
return pullRequests;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.GroupPriority = GroupPriority;
|
|
61
|
+
/**
|
|
62
|
+
* Helper to group candidates by their `type` field.
|
|
63
|
+
* @param {CandidateReleasePullRequest[]} inScopeCandidates The candidates to group.
|
|
64
|
+
* @returns {Map<string|undefined, CandidateReleasePullRequest[]>} The grouped
|
|
65
|
+
* pull requests.
|
|
66
|
+
*/
|
|
67
|
+
function groupCandidatesByType(inScopeCandidates) {
|
|
68
|
+
const groupedCandidates = new Map();
|
|
69
|
+
for (const candidatePullRequest of inScopeCandidates) {
|
|
70
|
+
const candidates = groupedCandidates.get(candidatePullRequest.pullRequest.group);
|
|
71
|
+
if (candidates) {
|
|
72
|
+
candidates.push(candidatePullRequest);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
groupedCandidates.set(candidatePullRequest.pullRequest.group, [
|
|
76
|
+
candidatePullRequest,
|
|
77
|
+
]);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return groupedCandidates;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=group-priority.js.map
|
|
@@ -122,6 +122,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
122
122
|
* @returns {Release} The candidate release.
|
|
123
123
|
*/
|
|
124
124
|
buildRelease(mergedPullRequest: PullRequest): Promise<Release | undefined>;
|
|
125
|
+
isPublishedVersion(_version: Version): boolean;
|
|
125
126
|
/**
|
|
126
127
|
* Override this to handle the initial version of a new library.
|
|
127
128
|
*/
|
|
@@ -346,6 +346,10 @@ class BaseStrategy {
|
|
|
346
346
|
this.logger.error('Pull request should have included version');
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
|
+
if (!this.isPublishedVersion(version)) {
|
|
350
|
+
this.logger.warn(`Skipping non-published version: ${version.toString()}`);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
349
353
|
const tag = new tag_name_1.TagName(version, this.includeComponentInTag ? component : undefined, this.tagSeparator, this.includeVInTag);
|
|
350
354
|
const releaseName = component && this.includeComponentInTag
|
|
351
355
|
? `${component}: v${version.toString()}`
|
|
@@ -357,6 +361,9 @@ class BaseStrategy {
|
|
|
357
361
|
sha: mergedPullRequest.sha,
|
|
358
362
|
};
|
|
359
363
|
}
|
|
364
|
+
isPublishedVersion(_version) {
|
|
365
|
+
return true;
|
|
366
|
+
}
|
|
360
367
|
/**
|
|
361
368
|
* Override this to handle the initial version of a new library.
|
|
362
369
|
*/
|
package/package.json
CHANGED
package/schemas/config.json
CHANGED
|
@@ -295,6 +295,24 @@
|
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
},
|
|
298
|
+
{
|
|
299
|
+
"description": "Configuration for various `group-priority` plugin",
|
|
300
|
+
"type": "object",
|
|
301
|
+
"properties": {
|
|
302
|
+
"type": {
|
|
303
|
+
"description": "The name of the plugin.",
|
|
304
|
+
"type": "string",
|
|
305
|
+
"enum": ["group-priority"]
|
|
306
|
+
},
|
|
307
|
+
"groups": {
|
|
308
|
+
"description": "Group names ordered with highest priority first.",
|
|
309
|
+
"type": "array",
|
|
310
|
+
"items": {
|
|
311
|
+
"type": "string"
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
},
|
|
298
316
|
{
|
|
299
317
|
"description": "Other plugins",
|
|
300
318
|
"type": "object",
|