release-please 14.3.0 → 14.5.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 +26 -0
- package/build/src/github.d.ts +24 -0
- package/build/src/github.js +32 -0
- package/build/src/manifest.d.ts +4 -0
- package/build/src/plugins/sentence-case.js +3 -2
- package/build/src/strategies/base.d.ts +2 -1
- package/build/src/strategies/base.js +69 -36
- package/build/src/strategies/java.js +1 -1
- package/build/src/updaters/elixir/elixir-mix-exs.js +8 -3
- package/build/src/util/pull-request-title.js +2 -0
- package/package.json +2 -2
- package/schemas/config.json +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
[1]: https://www.npmjs.com/package/release-please?activeTab=versions
|
|
6
6
|
|
|
7
|
+
## [14.5.0](https://github.com/googleapis/release-please/compare/v14.4.0...v14.5.0) (2022-09-07)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* Allow specifying glob option for extra-files ([#1621](https://github.com/googleapis/release-please/issues/1621)) ([d0fbd90](https://github.com/googleapis/release-please/commit/d0fbd90659f14b975ba56570712b8a4b1ed59e25)), closes [#1619](https://github.com/googleapis/release-please/issues/1619)
|
|
13
|
+
|
|
14
|
+
## [14.4.0](https://github.com/googleapis/release-please/compare/v14.3.1...v14.4.0) (2022-09-07)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* Update elixir version in module attribute ([#1630](https://github.com/googleapis/release-please/issues/1630)) ([1af59a1](https://github.com/googleapis/release-please/commit/1af59a162bc6b858c696a3cb4eee1ed9a47f4256))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* Allow parentheses in `pull-request-title-pattern` ([#1627](https://github.com/googleapis/release-please/issues/1627)) ([20f8684](https://github.com/googleapis/release-please/commit/20f8684740151ebcb7f902026c250a0e20515746))
|
|
25
|
+
|
|
26
|
+
## [14.3.1](https://github.com/googleapis/release-please/compare/v14.3.0...v14.3.1) (2022-09-06)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* **sentence-case:** handle multiple colons in subject ([0564594](https://github.com/googleapis/release-please/commit/05645949c771a3898a8521520322dd952c9aa6ff))
|
|
32
|
+
|
|
7
33
|
## [14.3.0](https://github.com/googleapis/release-please/compare/v14.2.4...v14.3.0) (2022-08-31)
|
|
8
34
|
|
|
9
35
|
|
package/build/src/github.d.ts
CHANGED
|
@@ -248,6 +248,30 @@ export declare class GitHub {
|
|
|
248
248
|
* @throws {GitHubAPIError} on an API error
|
|
249
249
|
*/
|
|
250
250
|
findFilesByFilenameAndRef: (filename: string, ref: string, prefix?: string | undefined) => Promise<string[]>;
|
|
251
|
+
/**
|
|
252
|
+
* Returns a list of paths to all files matching a glob pattern.
|
|
253
|
+
*
|
|
254
|
+
* If a prefix is specified, only return paths that match
|
|
255
|
+
* the provided prefix.
|
|
256
|
+
*
|
|
257
|
+
* @param glob The glob to match
|
|
258
|
+
* @param prefix Optional path prefix used to filter results
|
|
259
|
+
* @returns {string[]} List of file paths
|
|
260
|
+
* @throws {GitHubAPIError} on an API error
|
|
261
|
+
*/
|
|
262
|
+
findFilesByGlob(glob: string, prefix?: string): Promise<string[]>;
|
|
263
|
+
/**
|
|
264
|
+
* Returns a list of paths to all files matching a glob pattern.
|
|
265
|
+
*
|
|
266
|
+
* If a prefix is specified, only return paths that match
|
|
267
|
+
* the provided prefix.
|
|
268
|
+
*
|
|
269
|
+
* @param glob The glob to match
|
|
270
|
+
* @param ref Git reference to search files in
|
|
271
|
+
* @param prefix Optional path prefix used to filter results
|
|
272
|
+
* @throws {GitHubAPIError} on an API error
|
|
273
|
+
*/
|
|
274
|
+
findFilesByGlobAndRef: (glob: string, ref: string, prefix?: string | undefined) => Promise<string[]>;
|
|
251
275
|
/**
|
|
252
276
|
* Open a pull request
|
|
253
277
|
*
|
package/build/src/github.js
CHANGED
|
@@ -110,6 +110,24 @@ class GitHub {
|
|
|
110
110
|
this.logger.debug(`finding files by filename: ${filename}, ref: ${ref}, prefix: ${prefix}`);
|
|
111
111
|
return await this.fileCache.findFilesByFilename(filename, ref, prefix);
|
|
112
112
|
});
|
|
113
|
+
/**
|
|
114
|
+
* Returns a list of paths to all files matching a glob pattern.
|
|
115
|
+
*
|
|
116
|
+
* If a prefix is specified, only return paths that match
|
|
117
|
+
* the provided prefix.
|
|
118
|
+
*
|
|
119
|
+
* @param glob The glob to match
|
|
120
|
+
* @param ref Git reference to search files in
|
|
121
|
+
* @param prefix Optional path prefix used to filter results
|
|
122
|
+
* @throws {GitHubAPIError} on an API error
|
|
123
|
+
*/
|
|
124
|
+
this.findFilesByGlobAndRef = wrapAsync(async (glob, ref, prefix) => {
|
|
125
|
+
if (prefix) {
|
|
126
|
+
prefix = normalizePrefix(prefix);
|
|
127
|
+
}
|
|
128
|
+
this.logger.debug(`finding files by glob: ${glob}, ref: ${ref}, prefix: ${prefix}`);
|
|
129
|
+
return await this.fileCache.findFilesByGlob(glob, ref, prefix);
|
|
130
|
+
});
|
|
113
131
|
this.createPullRequest = wrapAsync(async (pullRequest, targetBranch, message, updates, options) => {
|
|
114
132
|
// Update the files for the release if not already supplied
|
|
115
133
|
const changes = await this.buildChangeSet(updates, targetBranch);
|
|
@@ -903,6 +921,20 @@ class GitHub {
|
|
|
903
921
|
async findFilesByFilename(filename, prefix) {
|
|
904
922
|
return this.findFilesByFilenameAndRef(filename, this.repository.defaultBranch, prefix);
|
|
905
923
|
}
|
|
924
|
+
/**
|
|
925
|
+
* Returns a list of paths to all files matching a glob pattern.
|
|
926
|
+
*
|
|
927
|
+
* If a prefix is specified, only return paths that match
|
|
928
|
+
* the provided prefix.
|
|
929
|
+
*
|
|
930
|
+
* @param glob The glob to match
|
|
931
|
+
* @param prefix Optional path prefix used to filter results
|
|
932
|
+
* @returns {string[]} List of file paths
|
|
933
|
+
* @throws {GitHubAPIError} on an API error
|
|
934
|
+
*/
|
|
935
|
+
async findFilesByGlob(glob, prefix) {
|
|
936
|
+
return this.findFilesByGlobAndRef(glob, this.repository.defaultBranch, prefix);
|
|
937
|
+
}
|
|
906
938
|
/**
|
|
907
939
|
* Open a pull request
|
|
908
940
|
*
|
package/build/src/manifest.d.ts
CHANGED
|
@@ -10,20 +10,24 @@ declare type ExtraJsonFile = {
|
|
|
10
10
|
type: 'json';
|
|
11
11
|
path: string;
|
|
12
12
|
jsonpath: string;
|
|
13
|
+
glob?: boolean;
|
|
13
14
|
};
|
|
14
15
|
declare type ExtraYamlFile = {
|
|
15
16
|
type: 'yaml';
|
|
16
17
|
path: string;
|
|
17
18
|
jsonpath: string;
|
|
19
|
+
glob?: boolean;
|
|
18
20
|
};
|
|
19
21
|
declare type ExtraXmlFile = {
|
|
20
22
|
type: 'xml';
|
|
21
23
|
path: string;
|
|
22
24
|
xpath: string;
|
|
25
|
+
glob?: boolean;
|
|
23
26
|
};
|
|
24
27
|
declare type ExtraPomFile = {
|
|
25
28
|
type: 'pom';
|
|
26
29
|
path: string;
|
|
30
|
+
glob?: boolean;
|
|
27
31
|
};
|
|
28
32
|
export declare type ExtraFile = string | ExtraJsonFile | ExtraYamlFile | ExtraXmlFile | ExtraPomFile;
|
|
29
33
|
/**
|
|
@@ -37,9 +37,10 @@ class SentenceCase extends plugin_1.ManifestPlugin {
|
|
|
37
37
|
// Check whether commit is in conventional commit format, if it is
|
|
38
38
|
// we'll split the string by type and description:
|
|
39
39
|
if (commit.message.includes(':')) {
|
|
40
|
-
|
|
40
|
+
const splitMessage = commit.message.split(':');
|
|
41
|
+
let prefix = splitMessage[0];
|
|
41
42
|
prefix += ': ';
|
|
42
|
-
suffix =
|
|
43
|
+
let suffix = splitMessage.slice(1).join(':').trim();
|
|
43
44
|
// Extract the first word from the rest of the string:
|
|
44
45
|
const match = /\s|$/.exec(suffix);
|
|
45
46
|
if (match) {
|
|
@@ -109,7 +109,8 @@ export declare abstract class BaseStrategy implements Strategy {
|
|
|
109
109
|
* open a pull request.
|
|
110
110
|
*/
|
|
111
111
|
buildReleasePullRequest(commits: Commit[], latestRelease?: Release, draft?: boolean, labels?: string[]): Promise<ReleasePullRequest | undefined>;
|
|
112
|
-
|
|
112
|
+
private extraFilePaths;
|
|
113
|
+
protected extraFileUpdates(version: Version, versionsMap: VersionsMap): Promise<Update[]>;
|
|
113
114
|
protected changelogEmpty(changelogEntry: string): boolean;
|
|
114
115
|
protected updateVersionsMap(versionsMap: VersionsMap, conventionalCommits: ConventionalCommit[], _newVersion: Version): Promise<VersionsMap>;
|
|
115
116
|
protected buildNewVersion(conventionalCommits: ConventionalCommit[], latestRelease?: Release): Promise<Version>;
|
|
@@ -165,7 +165,7 @@ class BaseStrategy {
|
|
|
165
165
|
versionsMap,
|
|
166
166
|
latestVersion: latestRelease === null || latestRelease === void 0 ? void 0 : latestRelease.tag.version,
|
|
167
167
|
});
|
|
168
|
-
const updatesWithExtras = (0, composite_1.mergeUpdates)(updates.concat(...this.extraFileUpdates(newVersion, versionsMap)));
|
|
168
|
+
const updatesWithExtras = (0, composite_1.mergeUpdates)(updates.concat(...(await this.extraFileUpdates(newVersion, versionsMap))));
|
|
169
169
|
const pullRequestBody = await this.buildPullRequestBody(component, newVersion, releaseNotesBody, conventionalCommits, latestRelease, this.pullRequestHeader);
|
|
170
170
|
return {
|
|
171
171
|
title: pullRequestTitle,
|
|
@@ -177,44 +177,77 @@ class BaseStrategy {
|
|
|
177
177
|
draft: draft !== null && draft !== void 0 ? draft : false,
|
|
178
178
|
};
|
|
179
179
|
}
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
// Helper to convert extra files with globs to the file paths to add
|
|
181
|
+
async extraFilePaths(extraFile) {
|
|
182
|
+
if (typeof extraFile !== 'object') {
|
|
183
|
+
return [extraFile];
|
|
184
|
+
}
|
|
185
|
+
if (!extraFile.glob) {
|
|
186
|
+
return [extraFile.path];
|
|
187
|
+
}
|
|
188
|
+
if (extraFile.path.startsWith('/')) {
|
|
189
|
+
// glob is relative to root, strip the leading `/` for glob matching
|
|
190
|
+
// and re-add the leading `/` to make the file relative to the root
|
|
191
|
+
return (await this.github.findFilesByGlobAndRef(extraFile.path.slice(1), this.targetBranch)).map(file => `/${file}`);
|
|
192
|
+
}
|
|
193
|
+
else if (this.path === manifest_1.ROOT_PROJECT_PATH) {
|
|
194
|
+
// root component, ignore path prefix
|
|
195
|
+
return this.github.findFilesByGlobAndRef(extraFile.path, this.targetBranch);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
// glob is relative to current path
|
|
199
|
+
return this.github.findFilesByGlobAndRef(extraFile.path, this.targetBranch, this.path);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
async extraFileUpdates(version, versionsMap) {
|
|
203
|
+
const extraFileUpdates = [];
|
|
204
|
+
for (const extraFile of this.extraFiles) {
|
|
182
205
|
if (typeof extraFile === 'object') {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
const paths = await this.extraFilePaths(extraFile);
|
|
207
|
+
for (const path of paths) {
|
|
208
|
+
switch (extraFile.type) {
|
|
209
|
+
case 'json':
|
|
210
|
+
extraFileUpdates.push({
|
|
211
|
+
path: this.addPath(path),
|
|
212
|
+
createIfMissing: false,
|
|
213
|
+
updater: new generic_json_1.GenericJson(extraFile.jsonpath, version),
|
|
214
|
+
});
|
|
215
|
+
break;
|
|
216
|
+
case 'yaml':
|
|
217
|
+
extraFileUpdates.push({
|
|
218
|
+
path: this.addPath(path),
|
|
219
|
+
createIfMissing: false,
|
|
220
|
+
updater: new generic_yaml_1.GenericYaml(extraFile.jsonpath, version),
|
|
221
|
+
});
|
|
222
|
+
break;
|
|
223
|
+
case 'xml':
|
|
224
|
+
extraFileUpdates.push({
|
|
225
|
+
path: this.addPath(path),
|
|
226
|
+
createIfMissing: false,
|
|
227
|
+
updater: new generic_xml_1.GenericXml(extraFile.xpath, version),
|
|
228
|
+
});
|
|
229
|
+
break;
|
|
230
|
+
case 'pom':
|
|
231
|
+
extraFileUpdates.push({
|
|
232
|
+
path: this.addPath(path),
|
|
233
|
+
createIfMissing: false,
|
|
234
|
+
updater: new pom_xml_1.PomXml(version),
|
|
235
|
+
});
|
|
236
|
+
break;
|
|
237
|
+
default:
|
|
238
|
+
throw new Error(`unsupported extraFile type: ${extraFile.type}`);
|
|
239
|
+
}
|
|
210
240
|
}
|
|
211
241
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
242
|
+
else {
|
|
243
|
+
extraFileUpdates.push({
|
|
244
|
+
path: this.addPath(extraFile),
|
|
245
|
+
createIfMissing: false,
|
|
246
|
+
updater: new generic_1.Generic({ version, versionsMap }),
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return extraFileUpdates;
|
|
218
251
|
}
|
|
219
252
|
changelogEmpty(changelogEntry) {
|
|
220
253
|
return changelogEntry.split('\n').length <= 1;
|
|
@@ -94,7 +94,7 @@ class Java extends base_1.BaseStrategy {
|
|
|
94
94
|
changelogEntry: notes,
|
|
95
95
|
isSnapshot: true,
|
|
96
96
|
});
|
|
97
|
-
const updatesWithExtras = (0, composite_1.mergeUpdates)(updates.concat(...this.extraFileUpdates(newVersion, versionsMap)));
|
|
97
|
+
const updatesWithExtras = (0, composite_1.mergeUpdates)(updates.concat(...(await this.extraFileUpdates(newVersion, versionsMap))));
|
|
98
98
|
return {
|
|
99
99
|
title: pullRequestTitle,
|
|
100
100
|
body: pullRequestBody,
|
|
@@ -26,9 +26,14 @@ class ElixirMixExs extends default_1.DefaultUpdater {
|
|
|
26
26
|
* @returns {string} The updated content
|
|
27
27
|
*/
|
|
28
28
|
updateContent(content, logger = logger_1.logger) {
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
logger.info(`updating from ${
|
|
29
|
+
const oldModuleAttributeVersion = content.match(/@version "([A-Za-z0-9_\-+.~]+)"/);
|
|
30
|
+
if (oldModuleAttributeVersion) {
|
|
31
|
+
logger.info(`updating module attribute version from ${oldModuleAttributeVersion[1]} to ${this.version}`);
|
|
32
|
+
return content.replace(/@version "[A-Za-z0-9_\-+.~]+"/, `@version "${this.version}"`);
|
|
33
|
+
}
|
|
34
|
+
const oldInlineVersion = content.match(/version: "([A-Za-z0-9_\-+.~]+)"/);
|
|
35
|
+
if (oldInlineVersion) {
|
|
36
|
+
logger.info(`updating inline version from ${oldInlineVersion[1]} to ${this.version}`);
|
|
32
37
|
}
|
|
33
38
|
return content.replace(/version: "[A-Za-z0-9_\-+.~]+",/, `version: "${this.version}",`);
|
|
34
39
|
}
|
|
@@ -33,6 +33,8 @@ function generateMatchPattern(pullRequestTitlePattern, logger = logger_1.logger)
|
|
|
33
33
|
return new RegExp(`^${(pullRequestTitlePattern || DEFAULT_PR_TITLE_PATTERN)
|
|
34
34
|
.replace('[', '\\[') // TODO: handle all regex escaping
|
|
35
35
|
.replace(']', '\\]')
|
|
36
|
+
.replace('(', '\\(')
|
|
37
|
+
.replace(')', '\\)')
|
|
36
38
|
.replace('${scope}', '(\\((?<branch>[\\w-./]+)\\))?')
|
|
37
39
|
.replace('${component}', ' ?(?<component>[\\w-./]*)?')
|
|
38
40
|
.replace('${version}', 'v?(?<version>[0-9].*)')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "release-please",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.5.0",
|
|
4
4
|
"description": "generate release PRs based on the conventionalcommits.org spec",
|
|
5
5
|
"main": "./build/src/index.js",
|
|
6
6
|
"bin": "./build/src/bin/release-please.js",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@conventional-commits/parser": "^0.4.1",
|
|
71
|
-
"@google-automations/git-file-utils": "^1.
|
|
71
|
+
"@google-automations/git-file-utils": "^1.2.0",
|
|
72
72
|
"@iarna/toml": "^2.2.5",
|
|
73
73
|
"@lerna/collect-updates": "^4.0.0",
|
|
74
74
|
"@lerna/package": "^4.0.0",
|
package/schemas/config.json
CHANGED
|
@@ -132,6 +132,10 @@
|
|
|
132
132
|
"description": "The path to the file.",
|
|
133
133
|
"type": "string"
|
|
134
134
|
},
|
|
135
|
+
"glob": {
|
|
136
|
+
"description": "Whether to treat the path as a glob. Defaults to `false`.",
|
|
137
|
+
"type": "boolean"
|
|
138
|
+
},
|
|
135
139
|
"jsonpath": {
|
|
136
140
|
"description": "The jsonpath to the version entry in the file.",
|
|
137
141
|
"type": "string"
|
|
@@ -151,6 +155,10 @@
|
|
|
151
155
|
"description": "The path to the file.",
|
|
152
156
|
"type": "string"
|
|
153
157
|
},
|
|
158
|
+
"glob": {
|
|
159
|
+
"description": "Whether to treat the path as a glob. Defaults to `false`.",
|
|
160
|
+
"type": "boolean"
|
|
161
|
+
},
|
|
154
162
|
"xpath": {
|
|
155
163
|
"description": "The xpath to the version entry in the file.",
|
|
156
164
|
"type": "string"
|
|
@@ -169,6 +177,10 @@
|
|
|
169
177
|
"path": {
|
|
170
178
|
"description": "The path to the file.",
|
|
171
179
|
"type": "string"
|
|
180
|
+
},
|
|
181
|
+
"glob": {
|
|
182
|
+
"description": "Whether to treat the path as a glob. Defaults to `false`.",
|
|
183
|
+
"type": "boolean"
|
|
172
184
|
}
|
|
173
185
|
},
|
|
174
186
|
"required": ["type", "path"]
|