release-please 14.7.2 → 14.9.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 +19 -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 +6 -1
- package/build/src/manifest.js +3 -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 +3 -0
- package/build/src/strategies/base.js +11 -0
- package/build/src/strategies/java.js +1 -0
- package/package.json +1 -1
- package/schemas/config.json +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
|
|
6
6
|
|
|
7
|
+
## [14.9.0](https://github.com/googleapis/release-please/compare/v14.8.0...v14.9.0) (2022-09-30)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* Add initial version to base strategy ([#1665](https://github.com/googleapis/release-please/issues/1665)) ([c867403](https://github.com/googleapis/release-please/commit/c867403e50cacbb88ddf545b2c0888f2c500edcc))
|
|
13
|
+
|
|
14
|
+
## [14.8.0](https://github.com/googleapis/release-please/compare/v14.7.2...v14.8.0) (2022-09-28)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* Add `group-priority` plugin ([#1660](https://github.com/googleapis/release-please/issues/1660)) ([3ca750a](https://github.com/googleapis/release-please/commit/3ca750af3be8af06f9b6d0ed835524d53eab09c5))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* Escape html tags in release notes ([#1661](https://github.com/googleapis/release-please/issues/1661)) ([891fdcb](https://github.com/googleapis/release-please/commit/891fdcb0776abd8b3518bb60c44873f55fd616a3))
|
|
25
|
+
|
|
7
26
|
## [14.7.2](https://github.com/googleapis/release-please/compare/v14.7.1...v14.7.2) (2022-09-26)
|
|
8
27
|
|
|
9
28
|
|
|
@@ -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
|
@@ -53,6 +53,7 @@ export interface ReleaserConfig {
|
|
|
53
53
|
separatePullRequests?: boolean;
|
|
54
54
|
labels?: string[];
|
|
55
55
|
releaseLabels?: string[];
|
|
56
|
+
initialVersion?: string;
|
|
56
57
|
changelogSections?: ChangelogSection[];
|
|
57
58
|
changelogPath?: string;
|
|
58
59
|
changelogType?: ChangelogNotesType;
|
|
@@ -98,6 +99,7 @@ interface ReleaserConfigJson {
|
|
|
98
99
|
'version-file'?: string;
|
|
99
100
|
'snapshot-label'?: string;
|
|
100
101
|
'skip-snapshot'?: boolean;
|
|
102
|
+
'initial-version'?: string;
|
|
101
103
|
}
|
|
102
104
|
export interface ManifestOptions {
|
|
103
105
|
bootstrapSha?: string;
|
|
@@ -142,7 +144,10 @@ export interface SentenceCasePluginConfig extends ConfigurablePluginType {
|
|
|
142
144
|
export interface WorkspacePluginConfig extends ConfigurablePluginType {
|
|
143
145
|
merge?: boolean;
|
|
144
146
|
}
|
|
145
|
-
export
|
|
147
|
+
export interface GroupPriorityPluginConfig extends ConfigurablePluginType {
|
|
148
|
+
groups: string[];
|
|
149
|
+
}
|
|
150
|
+
export declare type PluginType = DirectPluginType | ConfigurablePluginType | GroupPriorityPluginConfig | LinkedVersionPluginConfig | SentenceCasePluginConfig | WorkspacePluginConfig;
|
|
146
151
|
/**
|
|
147
152
|
* This is the schema of the manifest config json
|
|
148
153
|
*/
|
package/build/src/manifest.js
CHANGED
|
@@ -743,6 +743,7 @@ function extractReleaserConfig(config) {
|
|
|
743
743
|
labels: (_a = config['label']) === null || _a === void 0 ? void 0 : _a.split(','),
|
|
744
744
|
releaseLabels: (_b = config['release-label']) === null || _b === void 0 ? void 0 : _b.split(','),
|
|
745
745
|
skipSnapshot: config['skip-snapshot'],
|
|
746
|
+
initialVersion: config['initial-version'],
|
|
746
747
|
};
|
|
747
748
|
}
|
|
748
749
|
/**
|
|
@@ -949,7 +950,7 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, config,
|
|
|
949
950
|
return candidateTagVersion.sort((a, b) => b.compare(a))[0];
|
|
950
951
|
}
|
|
951
952
|
function mergeReleaserConfig(defaultConfig, pathConfig) {
|
|
952
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
953
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
953
954
|
return {
|
|
954
955
|
releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
|
|
955
956
|
bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
|
|
@@ -974,6 +975,7 @@ function mergeReleaserConfig(defaultConfig, pathConfig) {
|
|
|
974
975
|
pullRequestHeader: (_x = pathConfig.pullRequestHeader) !== null && _x !== void 0 ? _x : defaultConfig.pullRequestHeader,
|
|
975
976
|
separatePullRequests: (_y = pathConfig.separatePullRequests) !== null && _y !== void 0 ? _y : defaultConfig.separatePullRequests,
|
|
976
977
|
skipSnapshot: (_z = pathConfig.skipSnapshot) !== null && _z !== void 0 ? _z : defaultConfig.skipSnapshot,
|
|
978
|
+
initialVersion: (_0 = pathConfig.initialVersion) !== null && _0 !== void 0 ? _0 : defaultConfig.initialVersion,
|
|
977
979
|
};
|
|
978
980
|
}
|
|
979
981
|
/**
|
|
@@ -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
|
|
@@ -47,6 +47,7 @@ export interface BaseStrategyOptions {
|
|
|
47
47
|
snapshotLabels?: string[];
|
|
48
48
|
skipSnapshot?: boolean;
|
|
49
49
|
logger?: Logger;
|
|
50
|
+
initialVersion?: string;
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
52
53
|
* A strategy is responsible for determining which files are
|
|
@@ -68,6 +69,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
68
69
|
private releaseAs?;
|
|
69
70
|
protected includeComponentInTag: boolean;
|
|
70
71
|
protected includeVInTag: boolean;
|
|
72
|
+
protected initialVersion?: string;
|
|
71
73
|
readonly pullRequestTitlePattern?: string;
|
|
72
74
|
readonly pullRequestHeader?: string;
|
|
73
75
|
readonly extraFiles: ExtraFile[];
|
|
@@ -122,6 +124,7 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
122
124
|
* @returns {Release} The candidate release.
|
|
123
125
|
*/
|
|
124
126
|
buildRelease(mergedPullRequest: PullRequest): Promise<Release | undefined>;
|
|
127
|
+
isPublishedVersion(_version: Version): boolean;
|
|
125
128
|
/**
|
|
126
129
|
* Override this to handle the initial version of a new library.
|
|
127
130
|
*/
|
|
@@ -62,6 +62,7 @@ class BaseStrategy {
|
|
|
62
62
|
this.pullRequestTitlePattern = options.pullRequestTitlePattern;
|
|
63
63
|
this.pullRequestHeader = options.pullRequestHeader;
|
|
64
64
|
this.extraFiles = options.extraFiles || [];
|
|
65
|
+
this.initialVersion = options.initialVersion;
|
|
65
66
|
}
|
|
66
67
|
/**
|
|
67
68
|
* Return the component for this strategy. This may be a computed field.
|
|
@@ -346,6 +347,10 @@ class BaseStrategy {
|
|
|
346
347
|
this.logger.error('Pull request should have included version');
|
|
347
348
|
return;
|
|
348
349
|
}
|
|
350
|
+
if (!this.isPublishedVersion(version)) {
|
|
351
|
+
this.logger.warn(`Skipping non-published version: ${version.toString()}`);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
349
354
|
const tag = new tag_name_1.TagName(version, this.includeComponentInTag ? component : undefined, this.tagSeparator, this.includeVInTag);
|
|
350
355
|
const releaseName = component && this.includeComponentInTag
|
|
351
356
|
? `${component}: v${version.toString()}`
|
|
@@ -357,10 +362,16 @@ class BaseStrategy {
|
|
|
357
362
|
sha: mergedPullRequest.sha,
|
|
358
363
|
};
|
|
359
364
|
}
|
|
365
|
+
isPublishedVersion(_version) {
|
|
366
|
+
return true;
|
|
367
|
+
}
|
|
360
368
|
/**
|
|
361
369
|
* Override this to handle the initial version of a new library.
|
|
362
370
|
*/
|
|
363
371
|
initialReleaseVersion() {
|
|
372
|
+
if (this.initialVersion) {
|
|
373
|
+
return version_1.Version.parse(this.initialVersion);
|
|
374
|
+
}
|
|
364
375
|
return version_1.Version.parse('1.0.0');
|
|
365
376
|
}
|
|
366
377
|
/**
|
package/package.json
CHANGED
package/schemas/config.json
CHANGED
|
@@ -199,6 +199,10 @@
|
|
|
199
199
|
"skip-snapshot": {
|
|
200
200
|
"description": "If set, do not propose snapshot pull requests. Used by `java` strategies.",
|
|
201
201
|
"type": "boolean"
|
|
202
|
+
},
|
|
203
|
+
"initial-version": {
|
|
204
|
+
"description": "Releases the initial library with a specified version",
|
|
205
|
+
"type": "string"
|
|
202
206
|
}
|
|
203
207
|
}
|
|
204
208
|
}
|
|
@@ -295,6 +299,24 @@
|
|
|
295
299
|
}
|
|
296
300
|
}
|
|
297
301
|
},
|
|
302
|
+
{
|
|
303
|
+
"description": "Configuration for various `group-priority` plugin",
|
|
304
|
+
"type": "object",
|
|
305
|
+
"properties": {
|
|
306
|
+
"type": {
|
|
307
|
+
"description": "The name of the plugin.",
|
|
308
|
+
"type": "string",
|
|
309
|
+
"enum": ["group-priority"]
|
|
310
|
+
},
|
|
311
|
+
"groups": {
|
|
312
|
+
"description": "Group names ordered with highest priority first.",
|
|
313
|
+
"type": "array",
|
|
314
|
+
"items": {
|
|
315
|
+
"type": "string"
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
},
|
|
298
320
|
{
|
|
299
321
|
"description": "Other plugins",
|
|
300
322
|
"type": "object",
|